favorieten_widget.dart 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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: 3,
  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. ],
  161. controller: _model.tabBarController,
  162. onTap: (i) async {
  163. [() async {}, () async {}, () async {}][i]();
  164. },
  165. ),
  166. ),
  167. Expanded(
  168. child: TabBarView(
  169. controller: _model.tabBarController,
  170. children: [
  171. Column(
  172. mainAxisSize: MainAxisSize.max,
  173. children: [
  174. Text(
  175. FFLocalizations.of(context).getText(
  176. '1y5w12fr' /* Je persoonlijke agenda met eve... */,
  177. ),
  178. style: FlutterFlowTheme.of(context)
  179. .bodyMedium
  180. .override(
  181. font: GoogleFonts.inter(
  182. fontWeight: FlutterFlowTheme.of(context)
  183. .bodyMedium
  184. .fontWeight,
  185. fontStyle: FlutterFlowTheme.of(context)
  186. .bodyMedium
  187. .fontStyle,
  188. ),
  189. letterSpacing: 0.0,
  190. fontWeight: FlutterFlowTheme.of(context)
  191. .bodyMedium
  192. .fontWeight,
  193. fontStyle: FlutterFlowTheme.of(context)
  194. .bodyMedium
  195. .fontStyle,
  196. ),
  197. ),
  198. ],
  199. ),
  200. Column(
  201. mainAxisSize: MainAxisSize.max,
  202. children: [
  203. Text(
  204. FFLocalizations.of(context).getText(
  205. 'o7pt2vls' /* De gemeentes die je hebt gemar... */,
  206. ),
  207. style: FlutterFlowTheme.of(context)
  208. .bodyMedium
  209. .override(
  210. font: GoogleFonts.inter(
  211. fontWeight: FlutterFlowTheme.of(context)
  212. .bodyMedium
  213. .fontWeight,
  214. fontStyle: FlutterFlowTheme.of(context)
  215. .bodyMedium
  216. .fontStyle,
  217. ),
  218. letterSpacing: 0.0,
  219. fontWeight: FlutterFlowTheme.of(context)
  220. .bodyMedium
  221. .fontWeight,
  222. fontStyle: FlutterFlowTheme.of(context)
  223. .bodyMedium
  224. .fontStyle,
  225. ),
  226. ),
  227. ],
  228. ),
  229. Column(
  230. mainAxisSize: MainAxisSize.max,
  231. children: [
  232. FutureBuilder<ApiCallResponse>(
  233. future: FavorietenAgendaCall.call(),
  234. builder: (context, snapshot) {
  235. // Customize what your widget looks like when it's loading.
  236. if (!snapshot.hasData) {
  237. return Center(
  238. child: SizedBox(
  239. width: 80.0,
  240. height: 80.0,
  241. child: SpinKitFadingCircle(
  242. color: Color(0xFFB1061E),
  243. size: 80.0,
  244. ),
  245. ),
  246. );
  247. }
  248. final listViewFavorietenAgendaResponse =
  249. snapshot.data!;
  250. _model.debugBackendQueries[
  251. 'FavorietenAgendaCall_statusCode_ListView_5fedvgkl'] =
  252. debugSerializeParam(
  253. listViewFavorietenAgendaResponse.statusCode,
  254. ParamType.int,
  255. link:
  256. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  257. name: 'int',
  258. nullable: false,
  259. );
  260. _model.debugBackendQueries[
  261. 'FavorietenAgendaCall_responseBody_ListView_5fedvgkl'] =
  262. debugSerializeParam(
  263. listViewFavorietenAgendaResponse.bodyText,
  264. ParamType.String,
  265. link:
  266. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  267. name: 'String',
  268. nullable: false,
  269. );
  270. debugLogWidgetClass(_model);
  271. return Builder(
  272. builder: (context) {
  273. final favorieteGelegenheidItem =
  274. listViewFavorietenAgendaResponse
  275. .jsonBody
  276. .toList();
  277. if (favorieteGelegenheidItem.isEmpty) {
  278. return Image.asset(
  279. 'assets/images/logo800px.png',
  280. );
  281. }
  282. _model.debugGeneratorVariables[
  283. 'favorieteGelegenheidItem${favorieteGelegenheidItem.length > 100 ? ' (first 100)' : ''}'] =
  284. debugSerializeParam(
  285. favorieteGelegenheidItem.take(100),
  286. ParamType.JSON,
  287. isList: true,
  288. link:
  289. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=favorieten',
  290. name: 'dynamic',
  291. nullable: false,
  292. );
  293. debugLogWidgetClass(_model);
  294. return ListView.builder(
  295. padding: EdgeInsets.zero,
  296. shrinkWrap: true,
  297. scrollDirection: Axis.vertical,
  298. itemCount:
  299. favorieteGelegenheidItem.length,
  300. itemBuilder: (context,
  301. favorieteGelegenheidItemIndex) {
  302. final favorieteGelegenheidItemItem =
  303. favorieteGelegenheidItem[
  304. favorieteGelegenheidItemIndex];
  305. return InkWell(
  306. splashColor: Colors.transparent,
  307. focusColor: Colors.transparent,
  308. hoverColor: Colors.transparent,
  309. highlightColor: Colors.transparent,
  310. onTap: () async {
  311. context.pushNamed(
  312. HorecagelegenheidCurrentWidget
  313. .routeName,
  314. queryParameters: {
  315. 'nid': serializeParam(
  316. getJsonField(
  317. favorieteGelegenheidItemItem,
  318. r'''$.nid''',
  319. ).toString(),
  320. ParamType.String,
  321. ),
  322. }.withoutNulls,
  323. );
  324. },
  325. child: Material(
  326. color: Colors.transparent,
  327. child: ListTile(
  328. title: Text(
  329. getJsonField(
  330. favorieteGelegenheidItemItem,
  331. r'''$.node_title''',
  332. ).toString(),
  333. style: FlutterFlowTheme.of(
  334. context)
  335. .titleLarge
  336. .override(
  337. font: GoogleFonts
  338. .interTight(
  339. fontWeight:
  340. FlutterFlowTheme.of(
  341. context)
  342. .titleLarge
  343. .fontWeight,
  344. fontStyle:
  345. FlutterFlowTheme.of(
  346. context)
  347. .titleLarge
  348. .fontStyle,
  349. ),
  350. letterSpacing: 0.0,
  351. fontWeight:
  352. FlutterFlowTheme.of(
  353. context)
  354. .titleLarge
  355. .fontWeight,
  356. fontStyle:
  357. FlutterFlowTheme.of(
  358. context)
  359. .titleLarge
  360. .fontStyle,
  361. ),
  362. ),
  363. trailing: Icon(
  364. Icons
  365. .arrow_forward_ios_rounded,
  366. color: FlutterFlowTheme.of(
  367. context)
  368. .secondaryText,
  369. size: 24.0,
  370. ),
  371. tileColor:
  372. FlutterFlowTheme.of(context)
  373. .secondaryBackground,
  374. dense: false,
  375. contentPadding:
  376. EdgeInsetsDirectional
  377. .fromSTEB(12.0, 0.0,
  378. 12.0, 0.0),
  379. shape: RoundedRectangleBorder(
  380. borderRadius:
  381. BorderRadius.circular(
  382. 8.0),
  383. ),
  384. ),
  385. ),
  386. );
  387. },
  388. );
  389. },
  390. );
  391. },
  392. ),
  393. ],
  394. ),
  395. ],
  396. ),
  397. ),
  398. ],
  399. ),
  400. ),
  401. ],
  402. ),
  403. ),
  404. ),
  405. );
  406. }
  407. }