header_buttons_component_widget.dart 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 'package:aligned_tooltip/aligned_tooltip.dart';
  7. import 'package:flutter/material.dart';
  8. import 'package:flutter_spinkit/flutter_spinkit.dart';
  9. import 'package:google_fonts/google_fonts.dart';
  10. import 'package:provider/provider.dart';
  11. import 'header_buttons_component_model.dart';
  12. export 'header_buttons_component_model.dart';
  13. /// Standaard header-knoppen (drawer + terug) voor herbruik op alle pagina's
  14. class HeaderButtonsComponentWidget extends StatefulWidget {
  15. const HeaderButtonsComponentWidget({
  16. super.key,
  17. bool? showBackButton,
  18. }) : this.showBackButton = showBackButton ?? true;
  19. final bool showBackButton;
  20. @override
  21. State<HeaderButtonsComponentWidget> createState() =>
  22. _HeaderButtonsComponentWidgetState();
  23. }
  24. class _HeaderButtonsComponentWidgetState
  25. extends State<HeaderButtonsComponentWidget> with RouteAware {
  26. late HeaderButtonsComponentModel _model;
  27. @override
  28. void setState(VoidCallback callback) {
  29. super.setState(callback);
  30. _model.onUpdate();
  31. }
  32. @override
  33. void initState() {
  34. super.initState();
  35. _model = createModel(context, () => HeaderButtonsComponentModel());
  36. }
  37. @override
  38. void dispose() {
  39. routeObserver.unsubscribe(this);
  40. _model.maybeDispose();
  41. super.dispose();
  42. }
  43. @override
  44. void didUpdateWidget(HeaderButtonsComponentWidget oldWidget) {
  45. super.didUpdateWidget(oldWidget);
  46. _model.widget = widget;
  47. }
  48. @override
  49. void didChangeDependencies() {
  50. super.didChangeDependencies();
  51. final route = DebugModalRoute.of(context);
  52. if (route != null) {
  53. routeObserver.subscribe(this, route);
  54. }
  55. debugLogGlobalProperty(context);
  56. }
  57. @override
  58. void didPopNext() {
  59. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  60. setState(() => _model.isRouteVisible = true);
  61. debugLogWidgetClass(_model);
  62. }
  63. }
  64. @override
  65. void didPush() {
  66. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  67. setState(() => _model.isRouteVisible = true);
  68. debugLogWidgetClass(_model);
  69. }
  70. }
  71. @override
  72. void didPop() {
  73. _model.isRouteVisible = false;
  74. }
  75. @override
  76. void didPushNext() {
  77. _model.isRouteVisible = false;
  78. }
  79. @override
  80. Widget build(BuildContext context) {
  81. DebugFlutterFlowModelContext.maybeOf(context)
  82. ?.parentModelCallback
  83. ?.call(_model);
  84. context.watch<FFAppState>();
  85. return Align(
  86. alignment: AlignmentDirectional(0.0, 0.0),
  87. child: Row(
  88. mainAxisSize: MainAxisSize.max,
  89. children: [
  90. AlignedTooltip(
  91. content: Padding(
  92. padding: EdgeInsets.all(4.0),
  93. child: Text(
  94. FFLocalizations.of(context).getText(
  95. '17msrach' /* Menu openen */,
  96. ),
  97. style: FlutterFlowTheme.of(context).bodyLarge.override(
  98. font: GoogleFonts.inter(
  99. fontWeight:
  100. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  101. fontStyle:
  102. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  103. ),
  104. letterSpacing: 0.0,
  105. fontWeight:
  106. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  107. fontStyle:
  108. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  109. ),
  110. ),
  111. ),
  112. offset: 4.0,
  113. preferredDirection: AxisDirection.down,
  114. borderRadius: BorderRadius.circular(8.0),
  115. backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
  116. elevation: 4.0,
  117. tailBaseWidth: 24.0,
  118. tailLength: 12.0,
  119. waitDuration: Duration(milliseconds: 100),
  120. showDuration: Duration(milliseconds: 1500),
  121. triggerMode: TooltipTriggerMode.tap,
  122. child: FlutterFlowIconButton(
  123. borderRadius: 8.0,
  124. buttonSize: 40.0,
  125. fillColor: Color(0xFFB50808),
  126. icon: Icon(
  127. Icons.dehaze_outlined,
  128. color: FlutterFlowTheme.of(context).info,
  129. size: 24.0,
  130. ),
  131. onPressed: () async {
  132. Scaffold.of(context).openDrawer();
  133. },
  134. ),
  135. ),
  136. if (widget!.showBackButton == true)
  137. AlignedTooltip(
  138. content: Padding(
  139. padding: EdgeInsets.all(4.0),
  140. child: Text(
  141. FFLocalizations.of(context).getText(
  142. 'f8ay39rg' /* Terug */,
  143. ),
  144. style: FlutterFlowTheme.of(context).bodyLarge.override(
  145. font: GoogleFonts.inter(
  146. fontWeight:
  147. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  148. fontStyle:
  149. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  150. ),
  151. letterSpacing: 0.0,
  152. fontWeight:
  153. FlutterFlowTheme.of(context).bodyLarge.fontWeight,
  154. fontStyle:
  155. FlutterFlowTheme.of(context).bodyLarge.fontStyle,
  156. ),
  157. ),
  158. ),
  159. offset: 4.0,
  160. preferredDirection: AxisDirection.down,
  161. borderRadius: BorderRadius.circular(8.0),
  162. backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
  163. elevation: 4.0,
  164. tailBaseWidth: 24.0,
  165. tailLength: 12.0,
  166. waitDuration: Duration(milliseconds: 100),
  167. showDuration: Duration(milliseconds: 1500),
  168. triggerMode: TooltipTriggerMode.tap,
  169. child: Padding(
  170. padding: EdgeInsetsDirectional.fromSTEB(4.0, 0.0, 0.0, 0.0),
  171. child: FlutterFlowIconButton(
  172. borderColor: Color(0x00FF0000),
  173. borderRadius: 30.0,
  174. borderWidth: 1.0,
  175. buttonSize: 50.0,
  176. fillColor: Color(0xFFB50808),
  177. icon: Icon(
  178. Icons.arrow_back_outlined,
  179. color: Colors.white,
  180. size: 30.0,
  181. ),
  182. onPressed: () async {
  183. context.pop();
  184. },
  185. ),
  186. ),
  187. ),
  188. Flexible(
  189. child: Text(
  190. FFAppState().gemeenteSelectNaam != null &&
  191. FFAppState().gemeenteSelectNaam != ''
  192. ? FFAppState().gemeenteSelectNaam
  193. : FFAppState().provincieSelectName,
  194. style: FlutterFlowTheme.of(context).bodyMedium.override(
  195. font: GoogleFonts.inter(
  196. fontWeight:
  197. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  198. fontStyle:
  199. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  200. ),
  201. letterSpacing: 0.0,
  202. fontWeight:
  203. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  204. fontStyle:
  205. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  206. ),
  207. ),
  208. ),
  209. ],
  210. ),
  211. );
  212. }
  213. }