header_buttons_component_widget.dart 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import '/flutter_flow/flutter_flow_icon_button.dart';
  2. import '/flutter_flow/flutter_flow_theme.dart';
  3. import '/flutter_flow/flutter_flow_util.dart';
  4. import '/flutter_flow/flutter_flow_widgets.dart';
  5. import 'dart:ui';
  6. import '/custom_code/widgets/index.dart' as custom_widgets;
  7. import '/index.dart';
  8. import 'package:aligned_tooltip/aligned_tooltip.dart';
  9. import 'package:flutter/material.dart';
  10. import 'package:flutter_spinkit/flutter_spinkit.dart';
  11. import 'package:google_fonts/google_fonts.dart';
  12. import 'package:provider/provider.dart';
  13. import 'header_buttons_component_model.dart';
  14. export 'header_buttons_component_model.dart';
  15. /// Standaard header-knoppen (drawer + terug) voor herbruik op alle pagina's
  16. class HeaderButtonsComponentWidget extends StatefulWidget {
  17. const HeaderButtonsComponentWidget({
  18. super.key,
  19. bool? showBackButton,
  20. }) : this.showBackButton = showBackButton ?? true;
  21. final bool showBackButton;
  22. @override
  23. State<HeaderButtonsComponentWidget> createState() =>
  24. _HeaderButtonsComponentWidgetState();
  25. }
  26. class _HeaderButtonsComponentWidgetState
  27. extends State<HeaderButtonsComponentWidget> with RouteAware {
  28. late HeaderButtonsComponentModel _model;
  29. @override
  30. void setState(VoidCallback callback) {
  31. super.setState(callback);
  32. _model.onUpdate();
  33. }
  34. @override
  35. void initState() {
  36. super.initState();
  37. _model = createModel(context, () => HeaderButtonsComponentModel());
  38. }
  39. @override
  40. void dispose() {
  41. routeObserver.unsubscribe(this);
  42. _model.maybeDispose();
  43. super.dispose();
  44. }
  45. @override
  46. void didUpdateWidget(HeaderButtonsComponentWidget oldWidget) {
  47. super.didUpdateWidget(oldWidget);
  48. _model.widget = widget;
  49. }
  50. @override
  51. void didChangeDependencies() {
  52. super.didChangeDependencies();
  53. final route = DebugModalRoute.of(context);
  54. if (route != null) {
  55. routeObserver.subscribe(this, route);
  56. }
  57. debugLogGlobalProperty(context);
  58. }
  59. @override
  60. void didPopNext() {
  61. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  62. setState(() => _model.isRouteVisible = true);
  63. debugLogWidgetClass(_model);
  64. }
  65. }
  66. @override
  67. void didPush() {
  68. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  69. setState(() => _model.isRouteVisible = true);
  70. debugLogWidgetClass(_model);
  71. }
  72. }
  73. @override
  74. void didPop() {
  75. _model.isRouteVisible = false;
  76. }
  77. @override
  78. void didPushNext() {
  79. _model.isRouteVisible = false;
  80. }
  81. @override
  82. Widget build(BuildContext context) {
  83. DebugFlutterFlowModelContext.maybeOf(context)
  84. ?.parentModelCallback
  85. ?.call(_model);
  86. context.watch<FFAppState>();
  87. return Align(
  88. alignment: AlignmentDirectional(0.0, 0.0),
  89. child: Padding(
  90. padding: EdgeInsetsDirectional.fromSTEB(0.0, 28.0, 0.0, 0.0),
  91. child: Wrap(
  92. spacing: 0.0,
  93. runSpacing: 0.0,
  94. alignment: WrapAlignment.start,
  95. crossAxisAlignment: WrapCrossAlignment.center,
  96. direction: Axis.horizontal,
  97. runAlignment: WrapAlignment.start,
  98. verticalDirection: VerticalDirection.down,
  99. clipBehavior: Clip.none,
  100. children: [
  101. AlignedTooltip(
  102. content: Padding(
  103. padding: EdgeInsets.all(4.0),
  104. child: Text(
  105. FFLocalizations.of(context).getText(
  106. '17msrach' /* Menu openen */,
  107. ),
  108. style: FlutterFlowTheme.of(context).bodyLarge.override(
  109. font: GoogleFonts.roboto(
  110. fontWeight:
  111. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  112. fontStyle:
  113. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  114. ),
  115. letterSpacing: 0.0,
  116. fontWeight:
  117. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  118. fontStyle:
  119. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  120. ),
  121. ),
  122. ),
  123. offset: 4.0,
  124. preferredDirection: AxisDirection.down,
  125. borderRadius: BorderRadius.circular(8.0),
  126. backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
  127. elevation: 4.0,
  128. tailBaseWidth: 24.0,
  129. tailLength: 12.0,
  130. waitDuration: Duration(milliseconds: 100),
  131. showDuration: Duration(milliseconds: 1500),
  132. triggerMode: TooltipTriggerMode.tap,
  133. child: FlutterFlowIconButton(
  134. borderRadius: 8.0,
  135. buttonSize: 40.0,
  136. fillColor: FlutterFlowTheme.of(context).secondary,
  137. icon: Icon(
  138. Icons.dehaze_outlined,
  139. color: FlutterFlowTheme.of(context).info,
  140. size: 24.0,
  141. ),
  142. onPressed: () async {
  143. Scaffold.of(context).openDrawer();
  144. },
  145. ),
  146. ),
  147. if (widget!.showBackButton == true)
  148. AlignedTooltip(
  149. content: Padding(
  150. padding: EdgeInsets.all(4.0),
  151. child: Text(
  152. FFLocalizations.of(context).getText(
  153. 'jc7ha6d8' /* Terug */,
  154. ),
  155. style: FlutterFlowTheme.of(context).bodyLarge.override(
  156. font: GoogleFonts.roboto(
  157. fontWeight: FlutterFlowTheme.of(context)
  158. .bodyLarge
  159. .fontWeight,
  160. fontStyle: FlutterFlowTheme.of(context)
  161. .bodyLarge
  162. .fontStyle,
  163. ),
  164. letterSpacing: 0.0,
  165. fontWeight:
  166. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  167. fontStyle:
  168. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  169. ),
  170. ),
  171. ),
  172. offset: 4.0,
  173. preferredDirection: AxisDirection.down,
  174. borderRadius: BorderRadius.circular(8.0),
  175. backgroundColor:
  176. FlutterFlowTheme.of(context).secondaryBackground,
  177. elevation: 4.0,
  178. tailBaseWidth: 24.0,
  179. tailLength: 12.0,
  180. waitDuration: Duration(milliseconds: 100),
  181. showDuration: Duration(milliseconds: 1500),
  182. triggerMode: TooltipTriggerMode.tap,
  183. child: Padding(
  184. padding: EdgeInsetsDirectional.fromSTEB(4.0, 0.0, 0.0, 0.0),
  185. child: FlutterFlowIconButton(
  186. borderColor: Color(0x00FF0000),
  187. borderRadius: 8.0,
  188. borderWidth: 1.0,
  189. buttonSize: 50.0,
  190. fillColor: FlutterFlowTheme.of(context).secondary,
  191. icon: Icon(
  192. Icons.arrow_back_outlined,
  193. color: Colors.white,
  194. size: 30.0,
  195. ),
  196. onPressed: () async {
  197. context.pop();
  198. },
  199. ),
  200. ),
  201. ),
  202. Column(
  203. mainAxisSize: MainAxisSize.min,
  204. children: [
  205. ClipRRect(
  206. borderRadius: BorderRadius.circular(8.0),
  207. child: Image.asset(
  208. 'assets/images/logo800px.png',
  209. width: 150.0,
  210. height: 22.0,
  211. fit: BoxFit.contain,
  212. ),
  213. ),
  214. InkWell(
  215. splashColor: Colors.transparent,
  216. focusColor: Colors.transparent,
  217. hoverColor: Colors.transparent,
  218. highlightColor: Colors.transparent,
  219. onTap: () async {
  220. context.pushNamed(SelectprovinciegemeenteWidget.routeName);
  221. },
  222. child: Text(
  223. valueOrDefault<String>(
  224. FFAppState().gemeenteSelectNaam,
  225. 'Kies je gemeente',
  226. ),
  227. style: FlutterFlowTheme.of(context).bodyMedium.override(
  228. font: GoogleFonts.roboto(
  229. fontWeight: FlutterFlowTheme.of(context)
  230. .bodyMedium
  231. .fontWeight,
  232. fontStyle: FlutterFlowTheme.of(context)
  233. .bodyMedium
  234. .fontStyle,
  235. ),
  236. color: FlutterFlowTheme.of(context).secondary,
  237. letterSpacing: 0.0,
  238. fontWeight: FlutterFlowTheme.of(context)
  239. .bodyMedium
  240. .fontWeight,
  241. fontStyle:
  242. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  243. ),
  244. ),
  245. ),
  246. ],
  247. ),
  248. Container(
  249. width: 2.0,
  250. height: 2.0,
  251. child: custom_widgets.VerbindingsBanner(
  252. width: 2.0,
  253. height: 2.0,
  254. ),
  255. ),
  256. ],
  257. ),
  258. ),
  259. );
  260. }
  261. }