header_buttons_component_widget.dart 9.2 KB

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