home_widget.dart 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. import '/components/header_buttons_component_widget.dart';
  2. import '/flutter_flow/flutter_flow_choice_chips.dart';
  3. import '/flutter_flow/flutter_flow_theme.dart';
  4. import '/flutter_flow/flutter_flow_util.dart';
  5. import '/flutter_flow/flutter_flow_widgets.dart';
  6. import '/flutter_flow/form_field_controller.dart';
  7. import '/shared/drawer_component/drawer_component_widget.dart';
  8. import '/uitgaanspaginas/home_uitgaan_slider_component/home_uitgaan_slider_component_widget.dart';
  9. import '/uitgaanspaginas/home_uitgaantabel_kaart_component/home_uitgaantabel_kaart_component_widget.dart';
  10. import 'dart:ui';
  11. import '/custom_code/actions/index.dart' as actions;
  12. import '/flutter_flow/custom_functions.dart' as functions;
  13. import 'package:flutter/material.dart';
  14. import 'package:flutter_spinkit/flutter_spinkit.dart';
  15. import 'package:google_fonts/google_fonts.dart';
  16. import 'package:provider/provider.dart';
  17. import 'home_model.dart';
  18. export 'home_model.dart';
  19. class HomeWidget extends StatefulWidget {
  20. const HomeWidget({super.key});
  21. static String routeName = 'home';
  22. static String routePath = '/home';
  23. @override
  24. State<HomeWidget> createState() => _HomeWidgetState();
  25. }
  26. class _HomeWidgetState extends State<HomeWidget>
  27. with TickerProviderStateMixin, RouteAware {
  28. late HomeModel _model;
  29. final scaffoldKey = GlobalKey<ScaffoldState>();
  30. @override
  31. void initState() {
  32. super.initState();
  33. _model = createModel(context, () => HomeModel());
  34. _model.tabBarController = TabController(
  35. vsync: this,
  36. length: 5,
  37. initialIndex: 0,
  38. )
  39. ..addListener(() => safeSetState(() {}))
  40. ..addListener(() {
  41. debugLogWidgetClass(_model);
  42. });
  43. }
  44. @override
  45. void dispose() {
  46. routeObserver.unsubscribe(this);
  47. _model.dispose();
  48. super.dispose();
  49. }
  50. @override
  51. void didUpdateWidget(HomeWidget oldWidget) {
  52. super.didUpdateWidget(oldWidget);
  53. _model.widget = widget;
  54. }
  55. @override
  56. void didChangeDependencies() {
  57. super.didChangeDependencies();
  58. final route = DebugModalRoute.of(context);
  59. if (route != null) {
  60. routeObserver.subscribe(this, route);
  61. }
  62. debugLogGlobalProperty(context);
  63. }
  64. @override
  65. void didPopNext() {
  66. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  67. setState(() => _model.isRouteVisible = true);
  68. debugLogWidgetClass(_model);
  69. }
  70. }
  71. @override
  72. void didPush() {
  73. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  74. setState(() => _model.isRouteVisible = true);
  75. debugLogWidgetClass(_model);
  76. }
  77. }
  78. @override
  79. void didPop() {
  80. _model.isRouteVisible = false;
  81. }
  82. @override
  83. void didPushNext() {
  84. _model.isRouteVisible = false;
  85. }
  86. @override
  87. Widget build(BuildContext context) {
  88. DebugFlutterFlowModelContext.maybeOf(context)
  89. ?.parentModelCallback
  90. ?.call(_model);
  91. context.watch<FFAppState>();
  92. return GestureDetector(
  93. onTap: () {
  94. FocusScope.of(context).unfocus();
  95. FocusManager.instance.primaryFocus?.unfocus();
  96. },
  97. child: Scaffold(
  98. key: scaffoldKey,
  99. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  100. drawer: Drawer(
  101. elevation: 16.0,
  102. child: wrapWithModel(
  103. model: _model.drawerComponentModel,
  104. updateCallback: () => safeSetState(() {}),
  105. child: Builder(builder: (_) {
  106. return DebugFlutterFlowModelContext(
  107. rootModel: _model.rootModel,
  108. child: DrawerComponentWidget(),
  109. );
  110. }),
  111. ),
  112. ),
  113. appBar: PreferredSize(
  114. preferredSize: Size.fromHeight(50.0),
  115. child: AppBar(
  116. backgroundColor: FlutterFlowTheme.of(context).primaryText,
  117. iconTheme:
  118. IconThemeData(color: FlutterFlowTheme.of(context).secondary),
  119. automaticallyImplyLeading: false,
  120. actions: [],
  121. flexibleSpace: FlexibleSpaceBar(
  122. background: wrapWithModel(
  123. model: _model.headerButtonsComponentModel,
  124. updateCallback: () => safeSetState(() {}),
  125. child: Builder(builder: (_) {
  126. return DebugFlutterFlowModelContext(
  127. rootModel: _model.rootModel,
  128. child: HeaderButtonsComponentWidget(
  129. showBackButton: false,
  130. ),
  131. );
  132. }),
  133. ),
  134. centerTitle: true,
  135. expandedTitleScale: 1.0,
  136. ),
  137. bottom: PreferredSize(
  138. preferredSize: Size.fromHeight(70.0),
  139. child: Container(),
  140. ),
  141. toolbarHeight: MediaQuery.sizeOf(context).height * 0.25,
  142. elevation: 2.0,
  143. ),
  144. ),
  145. body: SafeArea(
  146. top: true,
  147. child: Column(
  148. mainAxisSize: MainAxisSize.max,
  149. children: [
  150. Material(
  151. color: Colors.transparent,
  152. elevation: 0.0,
  153. child: Container(
  154. height: 250.0,
  155. decoration: BoxDecoration(),
  156. child: wrapWithModel(
  157. model: _model.homeUitgaanSliderComponentModel,
  158. updateCallback: () => safeSetState(() {}),
  159. child: Builder(builder: (_) {
  160. return DebugFlutterFlowModelContext(
  161. rootModel: _model.rootModel,
  162. child: HomeUitgaanSliderComponentWidget(
  163. displayid: 'services_1',
  164. ),
  165. );
  166. }),
  167. ),
  168. ),
  169. ),
  170. FlutterFlowChoiceChips(
  171. options: [
  172. ChipData(FFLocalizations.of(context).getText(
  173. '8khvlnye' /* Alles */,
  174. )),
  175. ChipData(FFLocalizations.of(context).getText(
  176. 'iov8u1yi' /* Vandaag */,
  177. )),
  178. ChipData(FFLocalizations.of(context).getText(
  179. 'gco4jgol' /* Dit weekend */,
  180. )),
  181. ChipData(FFLocalizations.of(context).getText(
  182. 'h6ou1q9q' /* Deze week */,
  183. ))
  184. ],
  185. onChanged: (val) async {
  186. safeSetState(
  187. () => _model.choiceChipsValue = val?.firstOrNull);
  188. FFAppState().datumFilter = _model.choiceChipsValue!;
  189. safeSetState(() {});
  190. await actions.herlaadLijsten();
  191. },
  192. selectedChipStyle: ChipStyle(
  193. backgroundColor: FlutterFlowTheme.of(context).primary,
  194. textStyle: FlutterFlowTheme.of(context).bodyMedium.override(
  195. font: GoogleFonts.roboto(
  196. fontWeight: FlutterFlowTheme.of(context)
  197. .bodyMedium
  198. .fontWeight,
  199. fontStyle:
  200. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  201. ),
  202. color: FlutterFlowTheme.of(context).info,
  203. letterSpacing: 0.0,
  204. fontWeight:
  205. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  206. fontStyle:
  207. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  208. ),
  209. iconColor: FlutterFlowTheme.of(context).info,
  210. iconSize: 16.0,
  211. elevation: 0.0,
  212. borderRadius: BorderRadius.circular(8.0),
  213. ),
  214. unselectedChipStyle: ChipStyle(
  215. backgroundColor:
  216. FlutterFlowTheme.of(context).secondaryBackground,
  217. textStyle: FlutterFlowTheme.of(context).bodyMedium.override(
  218. font: GoogleFonts.roboto(
  219. fontWeight: FlutterFlowTheme.of(context)
  220. .bodyMedium
  221. .fontWeight,
  222. fontStyle:
  223. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  224. ),
  225. color: FlutterFlowTheme.of(context).secondaryText,
  226. letterSpacing: 0.0,
  227. fontWeight:
  228. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  229. fontStyle:
  230. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  231. ),
  232. iconColor: FlutterFlowTheme.of(context).secondaryText,
  233. iconSize: 16.0,
  234. elevation: 0.0,
  235. borderRadius: BorderRadius.circular(8.0),
  236. ),
  237. chipSpacing: 8.0,
  238. rowSpacing: 8.0,
  239. multiselect: false,
  240. initialized: _model.choiceChipsValue != null,
  241. alignment: WrapAlignment.start,
  242. controller: _model.choiceChipsValueController ??=
  243. FormFieldController<List<String>>(
  244. [
  245. FFLocalizations.of(context).getText(
  246. 'g09d1fb5' /* Alles */,
  247. )
  248. ],
  249. ),
  250. wrapped: true,
  251. ),
  252. Expanded(
  253. child: Column(
  254. children: [
  255. Align(
  256. alignment: Alignment(0.0, 0),
  257. child: TabBar(
  258. isScrollable: true,
  259. tabAlignment: TabAlignment.center,
  260. labelColor: FlutterFlowTheme.of(context).primaryText,
  261. unselectedLabelColor:
  262. FlutterFlowTheme.of(context).secondaryText,
  263. labelStyle:
  264. FlutterFlowTheme.of(context).titleMedium.override(
  265. font: GoogleFonts.roboto(
  266. fontWeight: FlutterFlowTheme.of(context)
  267. .titleMedium
  268. .fontWeight,
  269. fontStyle: FlutterFlowTheme.of(context)
  270. .titleMedium
  271. .fontStyle,
  272. ),
  273. letterSpacing: 0.0,
  274. fontWeight: FlutterFlowTheme.of(context)
  275. .titleMedium
  276. .fontWeight,
  277. fontStyle: FlutterFlowTheme.of(context)
  278. .titleMedium
  279. .fontStyle,
  280. ),
  281. unselectedLabelStyle:
  282. FlutterFlowTheme.of(context).titleMedium.override(
  283. font: GoogleFonts.roboto(
  284. fontWeight: FlutterFlowTheme.of(context)
  285. .titleMedium
  286. .fontWeight,
  287. fontStyle: FlutterFlowTheme.of(context)
  288. .titleMedium
  289. .fontStyle,
  290. ),
  291. letterSpacing: 0.0,
  292. fontWeight: FlutterFlowTheme.of(context)
  293. .titleMedium
  294. .fontWeight,
  295. fontStyle: FlutterFlowTheme.of(context)
  296. .titleMedium
  297. .fontStyle,
  298. ),
  299. indicatorColor: FlutterFlowTheme.of(context).secondary,
  300. tabs: [
  301. Tab(
  302. text: FFLocalizations.of(context).getText(
  303. 'eor4c9rz' /* Uitgaan */,
  304. ),
  305. ),
  306. Tab(
  307. text: FFLocalizations.of(context).getText(
  308. 'mx7sn4ne' /* Activiteiten */,
  309. ),
  310. ),
  311. Tab(
  312. text: FFLocalizations.of(context).getText(
  313. 'e6xyyt74' /* Cultuur & Info */,
  314. ),
  315. ),
  316. Tab(
  317. text: FFLocalizations.of(context).getText(
  318. 'uxy2nfok' /* Films */,
  319. ),
  320. ),
  321. Tab(
  322. text: FFLocalizations.of(context).getText(
  323. 'lx77xfrn' /* Jeugd */,
  324. ),
  325. ),
  326. ],
  327. controller: _model.tabBarController,
  328. onTap: (i) async {
  329. [
  330. () async {},
  331. () async {
  332. _model.tabActiviteitenGeladen = true;
  333. safeSetState(() {});
  334. },
  335. () async {
  336. _model.tabCultuurGeladen = true;
  337. safeSetState(() {});
  338. },
  339. () async {
  340. _model.tabFilmsGeladen = true;
  341. safeSetState(() {});
  342. },
  343. () async {
  344. _model.tabJeugdGeladen = true;
  345. safeSetState(() {});
  346. }
  347. ][i]();
  348. },
  349. ),
  350. ),
  351. Expanded(
  352. child: TabBarView(
  353. controller: _model.tabBarController,
  354. children: [
  355. Column(
  356. mainAxisSize: MainAxisSize.max,
  357. children: [
  358. Expanded(
  359. child: wrapWithModel(
  360. model: _model
  361. .homeUitgaantabelKaartComponentModel1,
  362. updateCallback: () => safeSetState(() {}),
  363. child: Builder(builder: (_) {
  364. return DebugFlutterFlowModelContext(
  365. rootModel: _model.rootModel,
  366. child:
  367. HomeUitgaantabelKaartComponentWidget(
  368. key: ValueKey(FFAppState().datumFilter),
  369. displayid: 'services_3',
  370. datumVan: functions.filterDatumVan(
  371. FFAppState().datumFilter),
  372. datumTot: functions.filterDatumTot(
  373. FFAppState().datumFilter),
  374. ),
  375. );
  376. }),
  377. ),
  378. ),
  379. ],
  380. ),
  381. Builder(
  382. builder: (context) {
  383. if (_model.tabActiviteitenGeladen) {
  384. return Column(
  385. mainAxisSize: MainAxisSize.max,
  386. children: [
  387. Expanded(
  388. child: wrapWithModel(
  389. model: _model
  390. .homeUitgaantabelKaartComponentModel2,
  391. updateCallback: () =>
  392. safeSetState(() {}),
  393. child: Builder(builder: (_) {
  394. return DebugFlutterFlowModelContext(
  395. rootModel: _model.rootModel,
  396. child:
  397. HomeUitgaantabelKaartComponentWidget(
  398. key: ValueKey(
  399. FFAppState().datumFilter),
  400. displayid: 'services_4',
  401. datumVan:
  402. functions.filterDatumVan(
  403. FFAppState().datumFilter),
  404. datumTot:
  405. functions.filterDatumTot(
  406. FFAppState().datumFilter),
  407. ),
  408. );
  409. }),
  410. ),
  411. ),
  412. ],
  413. );
  414. } else {
  415. return Container(
  416. width: 100.0,
  417. height: 100.0,
  418. decoration: BoxDecoration(
  419. color: FlutterFlowTheme.of(context)
  420. .secondaryBackground,
  421. ),
  422. );
  423. }
  424. },
  425. ),
  426. Builder(
  427. builder: (context) {
  428. if (_model.tabCultuurGeladen) {
  429. return Column(
  430. mainAxisSize: MainAxisSize.max,
  431. children: [
  432. Expanded(
  433. child: wrapWithModel(
  434. model: _model
  435. .homeUitgaantabelKaartComponentModel3,
  436. updateCallback: () =>
  437. safeSetState(() {}),
  438. child: Builder(builder: (_) {
  439. return DebugFlutterFlowModelContext(
  440. rootModel: _model.rootModel,
  441. child:
  442. HomeUitgaantabelKaartComponentWidget(
  443. key: ValueKey(
  444. FFAppState().datumFilter),
  445. displayid: 'services_5',
  446. datumVan:
  447. functions.filterDatumVan(
  448. FFAppState().datumFilter),
  449. datumTot:
  450. functions.filterDatumTot(
  451. FFAppState().datumFilter),
  452. ),
  453. );
  454. }),
  455. ),
  456. ),
  457. ],
  458. );
  459. } else {
  460. return Container(
  461. width: 100.0,
  462. height: 100.0,
  463. decoration: BoxDecoration(
  464. color: FlutterFlowTheme.of(context)
  465. .secondaryBackground,
  466. ),
  467. );
  468. }
  469. },
  470. ),
  471. Builder(
  472. builder: (context) {
  473. if (_model.tabFilmsGeladen) {
  474. return Column(
  475. mainAxisSize: MainAxisSize.max,
  476. children: [
  477. Expanded(
  478. child: wrapWithModel(
  479. model: _model
  480. .homeUitgaantabelKaartComponentModel4,
  481. updateCallback: () =>
  482. safeSetState(() {}),
  483. child: Builder(builder: (_) {
  484. return DebugFlutterFlowModelContext(
  485. rootModel: _model.rootModel,
  486. child:
  487. HomeUitgaantabelKaartComponentWidget(
  488. key: ValueKey(
  489. FFAppState().datumFilter),
  490. displayid: 'services_6',
  491. datumVan:
  492. functions.filterDatumVan(
  493. FFAppState().datumFilter),
  494. datumTot:
  495. functions.filterDatumTot(
  496. FFAppState().datumFilter),
  497. ),
  498. );
  499. }),
  500. ),
  501. ),
  502. ],
  503. );
  504. } else {
  505. return Container(
  506. width: 100.0,
  507. height: 100.0,
  508. decoration: BoxDecoration(
  509. color: FlutterFlowTheme.of(context)
  510. .secondaryBackground,
  511. ),
  512. );
  513. }
  514. },
  515. ),
  516. Builder(
  517. builder: (context) {
  518. if (_model.tabJeugdGeladen) {
  519. return Column(
  520. mainAxisSize: MainAxisSize.max,
  521. children: [
  522. Expanded(
  523. child: wrapWithModel(
  524. model: _model
  525. .homeUitgaantabelKaartComponentModel5,
  526. updateCallback: () =>
  527. safeSetState(() {}),
  528. child: Builder(builder: (_) {
  529. return DebugFlutterFlowModelContext(
  530. rootModel: _model.rootModel,
  531. child:
  532. HomeUitgaantabelKaartComponentWidget(
  533. key: ValueKey(
  534. FFAppState().datumFilter),
  535. displayid: 'services_7',
  536. datumVan:
  537. functions.filterDatumVan(
  538. FFAppState().datumFilter),
  539. datumTot:
  540. functions.filterDatumTot(
  541. FFAppState().datumFilter),
  542. ),
  543. );
  544. }),
  545. ),
  546. ),
  547. ],
  548. );
  549. } else {
  550. return Container(
  551. width: 100.0,
  552. height: 100.0,
  553. decoration: BoxDecoration(
  554. color: FlutterFlowTheme.of(context)
  555. .secondaryBackground,
  556. ),
  557. );
  558. }
  559. },
  560. ),
  561. ],
  562. ),
  563. ),
  564. ],
  565. ),
  566. ),
  567. ],
  568. ),
  569. ),
  570. ),
  571. );
  572. }
  573. }