favorieten_copy_widget.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. import '/components/header_buttons_component_widget.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 '/shared/drawer_component/drawer_component_widget.dart';
  6. import '/uitgaanspaginas/uitgaantabel_kaart/uitgaantabel_kaart_widget.dart';
  7. import 'dart:ui';
  8. import '/custom_code/actions/index.dart' as actions;
  9. import '/index.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:flutter/scheduler.dart';
  12. import 'package:flutter_spinkit/flutter_spinkit.dart';
  13. import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
  14. import 'package:google_fonts/google_fonts.dart';
  15. import 'package:provider/provider.dart';
  16. import 'favorieten_copy_model.dart';
  17. export 'favorieten_copy_model.dart';
  18. class FavorietenCopyWidget extends StatefulWidget {
  19. const FavorietenCopyWidget({super.key});
  20. static String routeName = 'favorietenCopy';
  21. static String routePath = '/favorietenCopy';
  22. @override
  23. State<FavorietenCopyWidget> createState() => _FavorietenCopyWidgetState();
  24. }
  25. class _FavorietenCopyWidgetState extends State<FavorietenCopyWidget>
  26. with TickerProviderStateMixin, RouteAware {
  27. late FavorietenCopyModel _model;
  28. final scaffoldKey = GlobalKey<ScaffoldState>();
  29. @override
  30. void initState() {
  31. super.initState();
  32. _model = createModel(context, () => FavorietenCopyModel());
  33. // On page load action.
  34. SchedulerBinding.instance.addPostFrameCallback((_) async {
  35. _model.responseActionDrupalRequestPageLoad = await actions.drupalRequest(
  36. 'GET',
  37. 'https://uitgaanskrant.com/nl/flutterdrup/favorieten_agenda.json',
  38. FFAppState().userSessionname,
  39. FFAppState().userSessionid,
  40. FFAppState().userToken,
  41. '',
  42. );
  43. _model.favorietenAgenda =
  44. _model.responseActionDrupalRequestPageLoad!.toList().cast<dynamic>();
  45. safeSetState(() {});
  46. });
  47. _model.tabBarController = TabController(
  48. vsync: this,
  49. length: 4,
  50. initialIndex: 0,
  51. )
  52. ..addListener(() => safeSetState(() {}))
  53. ..addListener(() {
  54. debugLogWidgetClass(_model);
  55. });
  56. }
  57. @override
  58. void dispose() {
  59. routeObserver.unsubscribe(this);
  60. _model.dispose();
  61. super.dispose();
  62. }
  63. @override
  64. void didUpdateWidget(FavorietenCopyWidget oldWidget) {
  65. super.didUpdateWidget(oldWidget);
  66. _model.widget = widget;
  67. }
  68. @override
  69. void didChangeDependencies() {
  70. super.didChangeDependencies();
  71. final route = DebugModalRoute.of(context);
  72. if (route != null) {
  73. routeObserver.subscribe(this, route);
  74. }
  75. debugLogGlobalProperty(context);
  76. }
  77. @override
  78. void didPopNext() {
  79. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  80. setState(() => _model.isRouteVisible = true);
  81. debugLogWidgetClass(_model);
  82. }
  83. }
  84. @override
  85. void didPush() {
  86. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  87. setState(() => _model.isRouteVisible = true);
  88. debugLogWidgetClass(_model);
  89. }
  90. }
  91. @override
  92. void didPop() {
  93. _model.isRouteVisible = false;
  94. }
  95. @override
  96. void didPushNext() {
  97. _model.isRouteVisible = false;
  98. }
  99. @override
  100. Widget build(BuildContext context) {
  101. DebugFlutterFlowModelContext.maybeOf(context)
  102. ?.parentModelCallback
  103. ?.call(_model);
  104. context.watch<FFAppState>();
  105. _model.uitgaantabelKaartModels.clear();
  106. return GestureDetector(
  107. onTap: () {
  108. FocusScope.of(context).unfocus();
  109. FocusManager.instance.primaryFocus?.unfocus();
  110. },
  111. child: Scaffold(
  112. key: scaffoldKey,
  113. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  114. drawer: Drawer(
  115. elevation: 16.0,
  116. child: wrapWithModel(
  117. model: _model.drawerComponentModel,
  118. updateCallback: () => safeSetState(() {}),
  119. child: Builder(builder: (_) {
  120. return DebugFlutterFlowModelContext(
  121. rootModel: _model.rootModel,
  122. child: DrawerComponentWidget(),
  123. );
  124. }),
  125. ),
  126. ),
  127. appBar: PreferredSize(
  128. preferredSize: Size.fromHeight(80.0),
  129. child: AppBar(
  130. backgroundColor: FlutterFlowTheme.of(context).info,
  131. automaticallyImplyLeading: false,
  132. actions: [],
  133. flexibleSpace: FlexibleSpaceBar(
  134. title: wrapWithModel(
  135. model: _model.headerButtonsComponentModel,
  136. updateCallback: () => safeSetState(() {}),
  137. child: Builder(builder: (_) {
  138. return DebugFlutterFlowModelContext(
  139. rootModel: _model.rootModel,
  140. child: HeaderButtonsComponentWidget(
  141. showBackButton: false,
  142. ),
  143. );
  144. }),
  145. ),
  146. centerTitle: true,
  147. expandedTitleScale: 1.0,
  148. ),
  149. elevation: 0.0,
  150. ),
  151. ),
  152. body: SafeArea(
  153. top: true,
  154. child: Column(
  155. mainAxisSize: MainAxisSize.max,
  156. children: [
  157. Expanded(
  158. child: Column(
  159. children: [
  160. Align(
  161. alignment: Alignment(0.0, 0),
  162. child: TabBar(
  163. isScrollable: true,
  164. tabAlignment: TabAlignment.center,
  165. labelColor: FlutterFlowTheme.of(context).primaryText,
  166. unselectedLabelColor:
  167. FlutterFlowTheme.of(context).secondaryText,
  168. labelStyle:
  169. FlutterFlowTheme.of(context).titleMedium.override(
  170. font: GoogleFonts.interTight(
  171. fontWeight: FlutterFlowTheme.of(context)
  172. .titleMedium
  173. .fontWeight,
  174. fontStyle: FlutterFlowTheme.of(context)
  175. .titleMedium
  176. .fontStyle,
  177. ),
  178. letterSpacing: 0.0,
  179. fontWeight: FlutterFlowTheme.of(context)
  180. .titleMedium
  181. .fontWeight,
  182. fontStyle: FlutterFlowTheme.of(context)
  183. .titleMedium
  184. .fontStyle,
  185. ),
  186. unselectedLabelStyle:
  187. FlutterFlowTheme.of(context).titleMedium.override(
  188. font: GoogleFonts.interTight(
  189. fontWeight: FlutterFlowTheme.of(context)
  190. .titleMedium
  191. .fontWeight,
  192. fontStyle: FlutterFlowTheme.of(context)
  193. .titleMedium
  194. .fontStyle,
  195. ),
  196. letterSpacing: 0.0,
  197. fontWeight: FlutterFlowTheme.of(context)
  198. .titleMedium
  199. .fontWeight,
  200. fontStyle: FlutterFlowTheme.of(context)
  201. .titleMedium
  202. .fontStyle,
  203. ),
  204. indicatorColor: FlutterFlowTheme.of(context).primary,
  205. tabs: [
  206. Tab(
  207. text: FFLocalizations.of(context).getText(
  208. 'sxsbwdh5' /* Persoonlijke agenda */,
  209. ),
  210. ),
  211. Tab(
  212. text: FFLocalizations.of(context).getText(
  213. '0n8r8p9y' /* Favoriete gemeenten */,
  214. ),
  215. ),
  216. Tab(
  217. text: FFLocalizations.of(context).getText(
  218. 'onk58tcz' /* Favoriete Gelegenheden */,
  219. ),
  220. ),
  221. Tab(
  222. text: FFLocalizations.of(context).getText(
  223. 'htdoblfs' /* Gebruiker */,
  224. ),
  225. ),
  226. ],
  227. controller: _model.tabBarController,
  228. onTap: (i) async {
  229. [
  230. () async {
  231. _model.responsActionDrupalRequest =
  232. await actions.drupalRequest(
  233. 'GET',
  234. 'https://uitgaanskrant.com/nl/flutterdrup/favorieten_agenda.json',
  235. FFAppState().userSessionname,
  236. FFAppState().userSessionid,
  237. FFAppState().userToken,
  238. '',
  239. );
  240. _model.favorietenAgenda = _model
  241. .responsActionDrupalRequest!
  242. .toList()
  243. .cast<dynamic>();
  244. safeSetState(() {});
  245. safeSetState(() {});
  246. },
  247. () async {},
  248. () async {
  249. _model.responseFavorieteHoreca =
  250. await actions.drupalRequest(
  251. 'GET',
  252. 'https://uitgaanskrant.com/nl/flutterdrup/favorieten_horeca.json',
  253. FFAppState().userSessionname,
  254. FFAppState().userSessionid,
  255. FFAppState().userToken,
  256. '',
  257. );
  258. _model.favorieteHorecagelegenheden = _model
  259. .responseFavorieteHoreca!
  260. .toList()
  261. .cast<dynamic>();
  262. safeSetState(() {});
  263. safeSetState(() {});
  264. },
  265. () async {}
  266. ][i]();
  267. },
  268. ),
  269. ),
  270. Expanded(
  271. child: TabBarView(
  272. controller: _model.tabBarController,
  273. children: [
  274. Column(
  275. mainAxisSize: MainAxisSize.max,
  276. children: [
  277. Expanded(
  278. child: Builder(
  279. builder: (context) {
  280. final favorietenAgendaItems =
  281. _model.favorietenAgenda.toList();
  282. _model.debugGeneratorVariables[
  283. 'favorietenAgendaItems${favorietenAgendaItems.length > 100 ? ' (first 100)' : ''}'] =
  284. debugSerializeParam(
  285. favorietenAgendaItems.take(100),
  286. ParamType.JSON,
  287. isList: true,
  288. link:
  289. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorietenCopy',
  290. name: 'dynamic',
  291. nullable: false,
  292. );
  293. debugLogWidgetClass(_model);
  294. return MasonryGridView.builder(
  295. gridDelegate:
  296. SliverSimpleGridDelegateWithFixedCrossAxisCount(
  297. crossAxisCount: 2,
  298. ),
  299. crossAxisSpacing: 10.0,
  300. mainAxisSpacing: 10.0,
  301. itemCount: favorietenAgendaItems.length,
  302. itemBuilder: (context,
  303. favorietenAgendaItemsIndex) {
  304. final favorietenAgendaItemsItem =
  305. favorietenAgendaItems[
  306. favorietenAgendaItemsIndex];
  307. return Builder(builder: (_) {
  308. return DebugFlutterFlowModelContext(
  309. rootModel: _model.rootModel,
  310. parentModelCallback: (m) {
  311. _model.uitgaantabelKaartModels[
  312. 'Key5m3_${favorietenAgendaItemsIndex}_of_${favorietenAgendaItems.length}'] = m;
  313. },
  314. child: UitgaantabelKaartWidget(
  315. key: Key(
  316. 'Key5m3_${favorietenAgendaItemsIndex}_of_${favorietenAgendaItems.length}'),
  317. logo: getJsonField(
  318. favorietenAgendaItemsItem,
  319. r'''$.logo''',
  320. ),
  321. categorie: getJsonField(
  322. favorietenAgendaItemsItem,
  323. r'''$.categorie''',
  324. ),
  325. titel: getJsonField(
  326. favorietenAgendaItemsItem,
  327. r'''$.titel''',
  328. ),
  329. horecagelegenheid: getJsonField(
  330. favorietenAgendaItemsItem,
  331. r'''$.horecagelegenheid''',
  332. ),
  333. adres: getJsonField(
  334. favorietenAgendaItemsItem,
  335. r'''$.adres''',
  336. ),
  337. plaats: getJsonField(
  338. favorietenAgendaItemsItem,
  339. r'''$.plaats''',
  340. ),
  341. datum: getJsonField(
  342. favorietenAgendaItemsItem,
  343. r'''$.datum''',
  344. ),
  345. inhoud: null,
  346. nid: getJsonField(
  347. favorietenAgendaItemsItem,
  348. r'''$.nid''',
  349. ),
  350. horecagelegenheidNid:
  351. getJsonField(
  352. favorietenAgendaItemsItem,
  353. r'''$.horecagelegenheidNid''',
  354. ),
  355. ),
  356. );
  357. });
  358. },
  359. );
  360. },
  361. ),
  362. ),
  363. ],
  364. ),
  365. Column(
  366. mainAxisSize: MainAxisSize.max,
  367. children: [
  368. Padding(
  369. padding: EdgeInsetsDirectional.fromSTEB(
  370. 16.0, 0.0, 16.0, 0.0),
  371. child: Text(
  372. FFLocalizations.of(context).getText(
  373. '8f3r68yl' /* De gemeentes die je hebt gemar... */,
  374. ),
  375. style: FlutterFlowTheme.of(context)
  376. .bodyMedium
  377. .override(
  378. font: GoogleFonts.inter(
  379. fontWeight:
  380. FlutterFlowTheme.of(context)
  381. .bodyMedium
  382. .fontWeight,
  383. fontStyle:
  384. FlutterFlowTheme.of(context)
  385. .bodyMedium
  386. .fontStyle,
  387. ),
  388. letterSpacing: 0.0,
  389. fontWeight: FlutterFlowTheme.of(context)
  390. .bodyMedium
  391. .fontWeight,
  392. fontStyle: FlutterFlowTheme.of(context)
  393. .bodyMedium
  394. .fontStyle,
  395. ),
  396. ),
  397. ),
  398. ],
  399. ),
  400. Column(
  401. mainAxisSize: MainAxisSize.max,
  402. children: [
  403. Builder(
  404. builder: (context) {
  405. final favorieteGelegenheidItem = _model
  406. .favorieteHorecagelegenheden
  407. .toList();
  408. if (favorieteGelegenheidItem.isEmpty) {
  409. return Image.asset(
  410. 'assets/images/logo800px.png',
  411. );
  412. }
  413. _model.debugGeneratorVariables[
  414. 'favorieteGelegenheidItem${favorieteGelegenheidItem.length > 100 ? ' (first 100)' : ''}'] =
  415. debugSerializeParam(
  416. favorieteGelegenheidItem.take(100),
  417. ParamType.JSON,
  418. isList: true,
  419. link:
  420. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorietenCopy',
  421. name: 'dynamic',
  422. nullable: false,
  423. );
  424. debugLogWidgetClass(_model);
  425. return ListView.builder(
  426. padding: EdgeInsets.zero,
  427. shrinkWrap: true,
  428. scrollDirection: Axis.vertical,
  429. itemCount: favorieteGelegenheidItem.length,
  430. itemBuilder: (context,
  431. favorieteGelegenheidItemIndex) {
  432. final favorieteGelegenheidItemItem =
  433. favorieteGelegenheidItem[
  434. favorieteGelegenheidItemIndex];
  435. return InkWell(
  436. splashColor: Colors.transparent,
  437. focusColor: Colors.transparent,
  438. hoverColor: Colors.transparent,
  439. highlightColor: Colors.transparent,
  440. onTap: () async {
  441. context.pushNamed(
  442. HorecagelegenheidCurrentWidget
  443. .routeName,
  444. queryParameters: {
  445. 'nid': serializeParam(
  446. getJsonField(
  447. favorieteGelegenheidItemItem,
  448. r'''$.nid''',
  449. ).toString(),
  450. ParamType.String,
  451. ),
  452. }.withoutNulls,
  453. );
  454. },
  455. child: Material(
  456. color: Colors.transparent,
  457. child: ListTile(
  458. title: Text(
  459. getJsonField(
  460. favorieteGelegenheidItemItem,
  461. r'''$.node_title''',
  462. ).toString(),
  463. style: FlutterFlowTheme.of(
  464. context)
  465. .titleLarge
  466. .override(
  467. font:
  468. GoogleFonts.interTight(
  469. fontWeight:
  470. FlutterFlowTheme.of(
  471. context)
  472. .titleLarge
  473. .fontWeight,
  474. fontStyle:
  475. FlutterFlowTheme.of(
  476. context)
  477. .titleLarge
  478. .fontStyle,
  479. ),
  480. letterSpacing: 0.0,
  481. fontWeight:
  482. FlutterFlowTheme.of(
  483. context)
  484. .titleLarge
  485. .fontWeight,
  486. fontStyle:
  487. FlutterFlowTheme.of(
  488. context)
  489. .titleLarge
  490. .fontStyle,
  491. ),
  492. ),
  493. trailing: Icon(
  494. Icons.arrow_forward_ios_rounded,
  495. color:
  496. FlutterFlowTheme.of(context)
  497. .secondaryText,
  498. size: 24.0,
  499. ),
  500. tileColor:
  501. FlutterFlowTheme.of(context)
  502. .secondaryBackground,
  503. dense: false,
  504. contentPadding:
  505. EdgeInsetsDirectional.fromSTEB(
  506. 12.0, 0.0, 12.0, 0.0),
  507. shape: RoundedRectangleBorder(
  508. borderRadius:
  509. BorderRadius.circular(8.0),
  510. ),
  511. ),
  512. ),
  513. );
  514. },
  515. );
  516. },
  517. ),
  518. ],
  519. ),
  520. Column(
  521. mainAxisSize: MainAxisSize.max,
  522. children: [
  523. InkWell(
  524. splashColor: Colors.transparent,
  525. focusColor: Colors.transparent,
  526. hoverColor: Colors.transparent,
  527. highlightColor: Colors.transparent,
  528. onTap: () async {
  529. FFAppState().deleteUserToken();
  530. FFAppState().userToken = '';
  531. FFAppState().deleteUserSessionid();
  532. FFAppState().userSessionid = '';
  533. FFAppState().deleteUserSessionname();
  534. FFAppState().userSessionname = '';
  535. FFAppState().deleteUserName();
  536. FFAppState().userName = '';
  537. FFAppState().deleteUserUid();
  538. FFAppState().userUid = 0;
  539. FFAppState().deleteUserMail();
  540. FFAppState().userMail = '';
  541. safeSetState(() {});
  542. context.goNamed(LoginWidget.routeName);
  543. },
  544. child: Material(
  545. color: Colors.transparent,
  546. child: ListTile(
  547. title: Text(
  548. FFLocalizations.of(context).getText(
  549. 'xj88822s' /* Uitloggen */,
  550. ),
  551. style: FlutterFlowTheme.of(context)
  552. .titleLarge
  553. .override(
  554. font: GoogleFonts.interTight(
  555. fontWeight:
  556. FlutterFlowTheme.of(context)
  557. .titleLarge
  558. .fontWeight,
  559. fontStyle:
  560. FlutterFlowTheme.of(context)
  561. .titleLarge
  562. .fontStyle,
  563. ),
  564. letterSpacing: 0.0,
  565. fontWeight:
  566. FlutterFlowTheme.of(context)
  567. .titleLarge
  568. .fontWeight,
  569. fontStyle:
  570. FlutterFlowTheme.of(context)
  571. .titleLarge
  572. .fontStyle,
  573. ),
  574. ),
  575. trailing: Icon(
  576. Icons.arrow_forward_ios_rounded,
  577. color: FlutterFlowTheme.of(context)
  578. .secondaryText,
  579. size: 24.0,
  580. ),
  581. tileColor: FlutterFlowTheme.of(context)
  582. .secondaryBackground,
  583. dense: false,
  584. contentPadding:
  585. EdgeInsetsDirectional.fromSTEB(
  586. 12.0, 0.0, 12.0, 0.0),
  587. shape: RoundedRectangleBorder(
  588. borderRadius: BorderRadius.circular(8.0),
  589. ),
  590. ),
  591. ),
  592. ),
  593. ],
  594. ),
  595. ],
  596. ),
  597. ),
  598. ],
  599. ),
  600. ),
  601. ],
  602. ),
  603. ),
  604. ),
  605. );
  606. }
  607. }