favorieten_widget.dart 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. import '/backend/api_requests/api_calls.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 '/index.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 'favorieten_model.dart';
  12. export 'favorieten_model.dart';
  13. class FavorietenWidget extends StatefulWidget {
  14. const FavorietenWidget({super.key});
  15. static String routeName = 'favorieten';
  16. static String routePath = '/favorieten';
  17. @override
  18. State<FavorietenWidget> createState() => _FavorietenWidgetState();
  19. }
  20. class _FavorietenWidgetState extends State<FavorietenWidget>
  21. with TickerProviderStateMixin, RouteAware {
  22. late FavorietenModel _model;
  23. final scaffoldKey = GlobalKey<ScaffoldState>();
  24. @override
  25. void initState() {
  26. super.initState();
  27. _model = createModel(context, () => FavorietenModel());
  28. _model.tabBarController = TabController(
  29. vsync: this,
  30. length: 4,
  31. initialIndex: 0,
  32. )
  33. ..addListener(() => safeSetState(() {}))
  34. ..addListener(() {
  35. debugLogWidgetClass(_model);
  36. });
  37. }
  38. @override
  39. void dispose() {
  40. routeObserver.unsubscribe(this);
  41. _model.dispose();
  42. super.dispose();
  43. }
  44. @override
  45. void didUpdateWidget(FavorietenWidget 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. return GestureDetector(
  86. onTap: () {
  87. FocusScope.of(context).unfocus();
  88. FocusManager.instance.primaryFocus?.unfocus();
  89. },
  90. child: Scaffold(
  91. key: scaffoldKey,
  92. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  93. body: SafeArea(
  94. top: true,
  95. child: Column(
  96. mainAxisSize: MainAxisSize.max,
  97. children: [
  98. Expanded(
  99. child: Column(
  100. children: [
  101. Align(
  102. alignment: Alignment(0.0, 0),
  103. child: TabBar(
  104. labelColor: FlutterFlowTheme.of(context).primaryText,
  105. unselectedLabelColor:
  106. FlutterFlowTheme.of(context).secondaryText,
  107. labelStyle:
  108. FlutterFlowTheme.of(context).titleMedium.override(
  109. font: GoogleFonts.interTight(
  110. fontWeight: FlutterFlowTheme.of(context)
  111. .titleMedium
  112. .fontWeight,
  113. fontStyle: FlutterFlowTheme.of(context)
  114. .titleMedium
  115. .fontStyle,
  116. ),
  117. letterSpacing: 0.0,
  118. fontWeight: FlutterFlowTheme.of(context)
  119. .titleMedium
  120. .fontWeight,
  121. fontStyle: FlutterFlowTheme.of(context)
  122. .titleMedium
  123. .fontStyle,
  124. ),
  125. unselectedLabelStyle:
  126. FlutterFlowTheme.of(context).titleMedium.override(
  127. font: GoogleFonts.interTight(
  128. fontWeight: FlutterFlowTheme.of(context)
  129. .titleMedium
  130. .fontWeight,
  131. fontStyle: FlutterFlowTheme.of(context)
  132. .titleMedium
  133. .fontStyle,
  134. ),
  135. letterSpacing: 0.0,
  136. fontWeight: FlutterFlowTheme.of(context)
  137. .titleMedium
  138. .fontWeight,
  139. fontStyle: FlutterFlowTheme.of(context)
  140. .titleMedium
  141. .fontStyle,
  142. ),
  143. indicatorColor: FlutterFlowTheme.of(context).primary,
  144. tabs: [
  145. Tab(
  146. text: FFLocalizations.of(context).getText(
  147. 'txq7zl0f' /* Persoonlijke agenda */,
  148. ),
  149. ),
  150. Tab(
  151. text: FFLocalizations.of(context).getText(
  152. '9wq117bv' /* Favoriete gemeenten */,
  153. ),
  154. ),
  155. Tab(
  156. text: FFLocalizations.of(context).getText(
  157. 'ygk8aifq' /* Favoriete Gelegenheden */,
  158. ),
  159. ),
  160. Tab(
  161. text: FFLocalizations.of(context).getText(
  162. 'jwojezxv' /* Gebruiker */,
  163. ),
  164. ),
  165. ],
  166. controller: _model.tabBarController,
  167. onTap: (i) async {
  168. [
  169. () async {},
  170. () async {},
  171. () async {},
  172. () async {}
  173. ][i]();
  174. },
  175. ),
  176. ),
  177. Expanded(
  178. child: TabBarView(
  179. controller: _model.tabBarController,
  180. children: [
  181. Column(
  182. mainAxisSize: MainAxisSize.max,
  183. children: [
  184. Text(
  185. FFLocalizations.of(context).getText(
  186. '1y5w12fr' /* Je persoonlijke agenda met eve... */,
  187. ),
  188. style: FlutterFlowTheme.of(context)
  189. .bodyMedium
  190. .override(
  191. font: GoogleFonts.inter(
  192. fontWeight: FlutterFlowTheme.of(context)
  193. .bodyMedium
  194. .fontWeight,
  195. fontStyle: FlutterFlowTheme.of(context)
  196. .bodyMedium
  197. .fontStyle,
  198. ),
  199. letterSpacing: 0.0,
  200. fontWeight: FlutterFlowTheme.of(context)
  201. .bodyMedium
  202. .fontWeight,
  203. fontStyle: FlutterFlowTheme.of(context)
  204. .bodyMedium
  205. .fontStyle,
  206. ),
  207. ),
  208. ],
  209. ),
  210. Column(
  211. mainAxisSize: MainAxisSize.max,
  212. children: [
  213. Text(
  214. FFLocalizations.of(context).getText(
  215. 'o7pt2vls' /* De gemeentes die je hebt gemar... */,
  216. ),
  217. style: FlutterFlowTheme.of(context)
  218. .bodyMedium
  219. .override(
  220. font: GoogleFonts.inter(
  221. fontWeight: FlutterFlowTheme.of(context)
  222. .bodyMedium
  223. .fontWeight,
  224. fontStyle: FlutterFlowTheme.of(context)
  225. .bodyMedium
  226. .fontStyle,
  227. ),
  228. letterSpacing: 0.0,
  229. fontWeight: FlutterFlowTheme.of(context)
  230. .bodyMedium
  231. .fontWeight,
  232. fontStyle: FlutterFlowTheme.of(context)
  233. .bodyMedium
  234. .fontStyle,
  235. ),
  236. ),
  237. ],
  238. ),
  239. Column(
  240. mainAxisSize: MainAxisSize.max,
  241. children: [
  242. FutureBuilder<ApiCallResponse>(
  243. future: FavorietenAgendaCall.call(),
  244. builder: (context, snapshot) {
  245. // Customize what your widget looks like when it's loading.
  246. if (!snapshot.hasData) {
  247. return Center(
  248. child: SizedBox(
  249. width: 80.0,
  250. height: 80.0,
  251. child: SpinKitFadingCircle(
  252. color: Color(0xFFB1061E),
  253. size: 80.0,
  254. ),
  255. ),
  256. );
  257. }
  258. final listViewFavorietenAgendaResponse =
  259. snapshot.data!;
  260. _model.debugBackendQueries[
  261. 'FavorietenAgendaCall_statusCode_ListView_5fedvgkl'] =
  262. debugSerializeParam(
  263. listViewFavorietenAgendaResponse.statusCode,
  264. ParamType.int,
  265. link:
  266. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  267. name: 'int',
  268. nullable: false,
  269. );
  270. _model.debugBackendQueries[
  271. 'FavorietenAgendaCall_responseBody_ListView_5fedvgkl'] =
  272. debugSerializeParam(
  273. listViewFavorietenAgendaResponse.bodyText,
  274. ParamType.String,
  275. link:
  276. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  277. name: 'String',
  278. nullable: false,
  279. );
  280. debugLogWidgetClass(_model);
  281. return Builder(
  282. builder: (context) {
  283. final favorieteGelegenheidItem =
  284. listViewFavorietenAgendaResponse
  285. .jsonBody
  286. .toList();
  287. if (favorieteGelegenheidItem.isEmpty) {
  288. return Image.asset(
  289. 'assets/images/logo800px.png',
  290. );
  291. }
  292. _model.debugGeneratorVariables[
  293. 'favorieteGelegenheidItem${favorieteGelegenheidItem.length > 100 ? ' (first 100)' : ''}'] =
  294. debugSerializeParam(
  295. favorieteGelegenheidItem.take(100),
  296. ParamType.JSON,
  297. isList: true,
  298. link:
  299. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  300. name: 'dynamic',
  301. nullable: false,
  302. );
  303. debugLogWidgetClass(_model);
  304. return ListView.builder(
  305. padding: EdgeInsets.zero,
  306. shrinkWrap: true,
  307. scrollDirection: Axis.vertical,
  308. itemCount:
  309. favorieteGelegenheidItem.length,
  310. itemBuilder: (context,
  311. favorieteGelegenheidItemIndex) {
  312. final favorieteGelegenheidItemItem =
  313. favorieteGelegenheidItem[
  314. favorieteGelegenheidItemIndex];
  315. return InkWell(
  316. splashColor: Colors.transparent,
  317. focusColor: Colors.transparent,
  318. hoverColor: Colors.transparent,
  319. highlightColor: Colors.transparent,
  320. onTap: () async {
  321. context.pushNamed(
  322. HorecagelegenheidCurrentWidget
  323. .routeName,
  324. queryParameters: {
  325. 'nid': serializeParam(
  326. getJsonField(
  327. favorieteGelegenheidItemItem,
  328. r'''$.nid''',
  329. ).toString(),
  330. ParamType.String,
  331. ),
  332. }.withoutNulls,
  333. );
  334. },
  335. child: Material(
  336. color: Colors.transparent,
  337. child: ListTile(
  338. title: Text(
  339. getJsonField(
  340. favorieteGelegenheidItemItem,
  341. r'''$.node_title''',
  342. ).toString(),
  343. style: FlutterFlowTheme.of(
  344. context)
  345. .titleLarge
  346. .override(
  347. font: GoogleFonts
  348. .interTight(
  349. fontWeight:
  350. FlutterFlowTheme.of(
  351. context)
  352. .titleLarge
  353. .fontWeight,
  354. fontStyle:
  355. FlutterFlowTheme.of(
  356. context)
  357. .titleLarge
  358. .fontStyle,
  359. ),
  360. letterSpacing: 0.0,
  361. fontWeight:
  362. FlutterFlowTheme.of(
  363. context)
  364. .titleLarge
  365. .fontWeight,
  366. fontStyle:
  367. FlutterFlowTheme.of(
  368. context)
  369. .titleLarge
  370. .fontStyle,
  371. ),
  372. ),
  373. trailing: Icon(
  374. Icons
  375. .arrow_forward_ios_rounded,
  376. color: FlutterFlowTheme.of(
  377. context)
  378. .secondaryText,
  379. size: 24.0,
  380. ),
  381. tileColor:
  382. FlutterFlowTheme.of(context)
  383. .secondaryBackground,
  384. dense: false,
  385. contentPadding:
  386. EdgeInsetsDirectional
  387. .fromSTEB(12.0, 0.0,
  388. 12.0, 0.0),
  389. shape: RoundedRectangleBorder(
  390. borderRadius:
  391. BorderRadius.circular(
  392. 8.0),
  393. ),
  394. ),
  395. ),
  396. );
  397. },
  398. );
  399. },
  400. );
  401. },
  402. ),
  403. ],
  404. ),
  405. Column(
  406. mainAxisSize: MainAxisSize.max,
  407. children: [
  408. InkWell(
  409. splashColor: Colors.transparent,
  410. focusColor: Colors.transparent,
  411. hoverColor: Colors.transparent,
  412. highlightColor: Colors.transparent,
  413. onTap: () async {
  414. FFAppState().deleteUserToken();
  415. FFAppState().userToken = '';
  416. FFAppState().deleteUserSessionid();
  417. FFAppState().userSessionid = '';
  418. FFAppState().deleteUserSessionname();
  419. FFAppState().userSessionname = '';
  420. FFAppState().deleteUserName();
  421. FFAppState().userName = '';
  422. FFAppState().deleteUserUid();
  423. FFAppState().userUid = 0;
  424. FFAppState().deleteUserMail();
  425. FFAppState().userMail = '';
  426. safeSetState(() {});
  427. context.goNamed(LoginWidget.routeName);
  428. },
  429. child: Material(
  430. color: Colors.transparent,
  431. child: ListTile(
  432. title: Text(
  433. FFLocalizations.of(context).getText(
  434. '275gmehq' /* Uitloggen */,
  435. ),
  436. style: FlutterFlowTheme.of(context)
  437. .titleLarge
  438. .override(
  439. font: GoogleFonts.interTight(
  440. fontWeight:
  441. FlutterFlowTheme.of(context)
  442. .titleLarge
  443. .fontWeight,
  444. fontStyle:
  445. FlutterFlowTheme.of(context)
  446. .titleLarge
  447. .fontStyle,
  448. ),
  449. letterSpacing: 0.0,
  450. fontWeight:
  451. FlutterFlowTheme.of(context)
  452. .titleLarge
  453. .fontWeight,
  454. fontStyle:
  455. FlutterFlowTheme.of(context)
  456. .titleLarge
  457. .fontStyle,
  458. ),
  459. ),
  460. trailing: Icon(
  461. Icons.arrow_forward_ios_rounded,
  462. color: FlutterFlowTheme.of(context)
  463. .secondaryText,
  464. size: 24.0,
  465. ),
  466. tileColor: FlutterFlowTheme.of(context)
  467. .secondaryBackground,
  468. dense: false,
  469. contentPadding:
  470. EdgeInsetsDirectional.fromSTEB(
  471. 12.0, 0.0, 12.0, 0.0),
  472. shape: RoundedRectangleBorder(
  473. borderRadius: BorderRadius.circular(8.0),
  474. ),
  475. ),
  476. ),
  477. ),
  478. ],
  479. ),
  480. ],
  481. ),
  482. ),
  483. ],
  484. ),
  485. ),
  486. ],
  487. ),
  488. ),
  489. ),
  490. );
  491. }
  492. }