header_buttons_component_widget.dart 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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: Wrap(
  89. spacing: 0.0,
  90. runSpacing: 0.0,
  91. alignment: WrapAlignment.start,
  92. crossAxisAlignment: WrapCrossAlignment.start,
  93. direction: Axis.horizontal,
  94. runAlignment: WrapAlignment.start,
  95. verticalDirection: VerticalDirection.down,
  96. clipBehavior: Clip.none,
  97. children: [
  98. AlignedTooltip(
  99. content: Padding(
  100. padding: EdgeInsets.all(4.0),
  101. child: Text(
  102. FFLocalizations.of(context).getText(
  103. '17msrach' /* Menu openen */,
  104. ),
  105. style: FlutterFlowTheme.of(context).bodyLarge.override(
  106. font: GoogleFonts.roboto(
  107. fontWeight:
  108. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  109. fontStyle:
  110. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  111. ),
  112. letterSpacing: 0.0,
  113. fontWeight:
  114. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  115. fontStyle:
  116. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  117. ),
  118. ),
  119. ),
  120. offset: 4.0,
  121. preferredDirection: AxisDirection.down,
  122. borderRadius: BorderRadius.circular(8.0),
  123. backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
  124. elevation: 4.0,
  125. tailBaseWidth: 24.0,
  126. tailLength: 12.0,
  127. waitDuration: Duration(milliseconds: 100),
  128. showDuration: Duration(milliseconds: 1500),
  129. triggerMode: TooltipTriggerMode.tap,
  130. child: FlutterFlowIconButton(
  131. borderRadius: 8.0,
  132. buttonSize: 40.0,
  133. fillColor: FlutterFlowTheme.of(context).secondary,
  134. icon: Icon(
  135. Icons.dehaze_outlined,
  136. color: FlutterFlowTheme.of(context).info,
  137. size: 24.0,
  138. ),
  139. onPressed: () async {
  140. Scaffold.of(context).openDrawer();
  141. },
  142. ),
  143. ),
  144. if (widget!.showBackButton == true)
  145. AlignedTooltip(
  146. content: Padding(
  147. padding: EdgeInsets.all(4.0),
  148. child: Text(
  149. FFLocalizations.of(context).getText(
  150. 'jc7ha6d8' /* Terug */,
  151. ),
  152. style: FlutterFlowTheme.of(context).bodyLarge.override(
  153. font: GoogleFonts.roboto(
  154. fontWeight:
  155. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  156. fontStyle:
  157. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  158. ),
  159. letterSpacing: 0.0,
  160. fontWeight:
  161. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  162. fontStyle:
  163. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  164. ),
  165. ),
  166. ),
  167. offset: 4.0,
  168. preferredDirection: AxisDirection.down,
  169. borderRadius: BorderRadius.circular(8.0),
  170. backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
  171. elevation: 4.0,
  172. tailBaseWidth: 24.0,
  173. tailLength: 12.0,
  174. waitDuration: Duration(milliseconds: 100),
  175. showDuration: Duration(milliseconds: 1500),
  176. triggerMode: TooltipTriggerMode.tap,
  177. child: Padding(
  178. padding: EdgeInsetsDirectional.fromSTEB(4.0, 0.0, 0.0, 0.0),
  179. child: FlutterFlowIconButton(
  180. borderColor: Color(0x00FF0000),
  181. borderRadius: 30.0,
  182. borderWidth: 1.0,
  183. buttonSize: 50.0,
  184. fillColor: FlutterFlowTheme.of(context).secondary,
  185. icon: Icon(
  186. Icons.arrow_back_outlined,
  187. color: Colors.white,
  188. size: 30.0,
  189. ),
  190. onPressed: () async {
  191. context.pop();
  192. },
  193. ),
  194. ),
  195. ),
  196. ClipRRect(
  197. borderRadius: BorderRadius.circular(8.0),
  198. child: Image.asset(
  199. 'assets/images/logo800px.png',
  200. width: 200.0,
  201. height: 200.0,
  202. fit: BoxFit.contain,
  203. ),
  204. ),
  205. InkWell(
  206. splashColor: Colors.transparent,
  207. focusColor: Colors.transparent,
  208. hoverColor: Colors.transparent,
  209. highlightColor: Colors.transparent,
  210. onTap: () async {
  211. context.pushNamed(SelectprovinciegemeenteWidget.routeName);
  212. },
  213. child: Text(
  214. FFAppState().gemeenteSelectNaam,
  215. style: FlutterFlowTheme.of(context).bodyMedium.override(
  216. font: GoogleFonts.roboto(
  217. fontWeight:
  218. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  219. fontStyle:
  220. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  221. ),
  222. letterSpacing: 0.0,
  223. fontWeight:
  224. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  225. fontStyle:
  226. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  227. ),
  228. ),
  229. ),
  230. Container(
  231. width: 2.0,
  232. height: 2.0,
  233. child: custom_widgets.VerbindingsBanner(
  234. width: 2.0,
  235. height: 2.0,
  236. ),
  237. ),
  238. ],
  239. ),
  240. );
  241. }
  242. }