uitgaantabel_kaart_component_widget.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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 '/shared/tag_categorie_component/tag_categorie_component_widget.dart';
  6. import 'dart:ui';
  7. import 'dart:async';
  8. import 'package:auto_size_text/auto_size_text.dart';
  9. import 'package:cached_network_image/cached_network_image.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:flutter_spinkit/flutter_spinkit.dart';
  12. import 'package:google_fonts/google_fonts.dart';
  13. import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
  14. import 'package:provider/provider.dart';
  15. import 'uitgaantabel_kaart_component_model.dart';
  16. export 'uitgaantabel_kaart_component_model.dart';
  17. class UitgaantabelKaartComponentWidget extends StatefulWidget {
  18. const UitgaantabelKaartComponentWidget({
  19. super.key,
  20. required this.towndid,
  21. required this.displayid,
  22. });
  23. final String? towndid;
  24. final String? displayid;
  25. @override
  26. State<UitgaantabelKaartComponentWidget> createState() =>
  27. _UitgaantabelKaartComponentWidgetState();
  28. }
  29. class _UitgaantabelKaartComponentWidgetState
  30. extends State<UitgaantabelKaartComponentWidget> with RouteAware {
  31. late UitgaantabelKaartComponentModel _model;
  32. @override
  33. void setState(VoidCallback callback) {
  34. super.setState(callback);
  35. _model.onUpdate();
  36. }
  37. @override
  38. void initState() {
  39. super.initState();
  40. _model = createModel(context, () => UitgaantabelKaartComponentModel());
  41. }
  42. @override
  43. void dispose() {
  44. routeObserver.unsubscribe(this);
  45. _model.maybeDispose();
  46. super.dispose();
  47. }
  48. @override
  49. void didUpdateWidget(UitgaantabelKaartComponentWidget oldWidget) {
  50. super.didUpdateWidget(oldWidget);
  51. _model.widget = widget;
  52. }
  53. @override
  54. void didChangeDependencies() {
  55. super.didChangeDependencies();
  56. final route = DebugModalRoute.of(context);
  57. if (route != null) {
  58. routeObserver.subscribe(this, route);
  59. }
  60. debugLogGlobalProperty(context);
  61. }
  62. @override
  63. void didPopNext() {
  64. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  65. setState(() => _model.isRouteVisible = true);
  66. debugLogWidgetClass(_model);
  67. }
  68. }
  69. @override
  70. void didPush() {
  71. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  72. setState(() => _model.isRouteVisible = true);
  73. debugLogWidgetClass(_model);
  74. }
  75. }
  76. @override
  77. void didPop() {
  78. _model.isRouteVisible = false;
  79. }
  80. @override
  81. void didPushNext() {
  82. _model.isRouteVisible = false;
  83. }
  84. @override
  85. Widget build(BuildContext context) {
  86. DebugFlutterFlowModelContext.maybeOf(context)
  87. ?.parentModelCallback
  88. ?.call(_model);
  89. _model.tagCategorieComponentModels.clear();
  90. return Padding(
  91. padding: EdgeInsetsDirectional.fromSTEB(
  92. valueOrDefault<double>(
  93. () {
  94. if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
  95. return 5.0;
  96. } else if (MediaQuery.sizeOf(context).width < kBreakpointMedium) {
  97. return 10.0;
  98. } else if (MediaQuery.sizeOf(context).width < kBreakpointLarge) {
  99. return 15.0;
  100. } else {
  101. return 10.0;
  102. }
  103. }(),
  104. 0.0,
  105. ),
  106. 0.0,
  107. 0.0,
  108. 0.0),
  109. child: RefreshIndicator(
  110. onRefresh: () async {
  111. safeSetState(() => _model.listViewPagingController?.refresh());
  112. await _model.waitForOnePageForListView();
  113. },
  114. child: PagedListView<ApiPagingParams, dynamic>(
  115. pagingController: _model.setListViewController(
  116. (nextPageMarker) => UitgaanstabelCall.call(
  117. page: nextPageMarker.nextPageNumber,
  118. townid: widget!.towndid,
  119. displayId: widget!.displayid,
  120. ),
  121. ),
  122. padding: EdgeInsets.zero,
  123. shrinkWrap: true,
  124. reverse: false,
  125. scrollDirection: Axis.vertical,
  126. builderDelegate: PagedChildBuilderDelegate<dynamic>(
  127. // Customize what your widget looks like when it's loading the first page.
  128. firstPageProgressIndicatorBuilder: (_) => Center(
  129. child: SizedBox(
  130. width: 80.0,
  131. height: 80.0,
  132. child: SpinKitFadingCircle(
  133. color: Color(0xFFB1061E),
  134. size: 80.0,
  135. ),
  136. ),
  137. ),
  138. // Customize what your widget looks like when it's loading another page.
  139. newPageProgressIndicatorBuilder: (_) => Center(
  140. child: SizedBox(
  141. width: 80.0,
  142. height: 80.0,
  143. child: SpinKitFadingCircle(
  144. color: Color(0xFFB1061E),
  145. size: 80.0,
  146. ),
  147. ),
  148. ),
  149. itemBuilder: (context, _, evenementenIndex) {
  150. final evenementenItem =
  151. _model.listViewPagingController!.itemList![evenementenIndex];
  152. return Padding(
  153. padding: EdgeInsetsDirectional.fromSTEB(12.0, 8.0, 12.0, 8.0),
  154. child: Container(
  155. height: () {
  156. if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
  157. return 160.0;
  158. } else if (MediaQuery.sizeOf(context).width <
  159. kBreakpointMedium) {
  160. return 200.0;
  161. } else if (MediaQuery.sizeOf(context).width <
  162. kBreakpointLarge) {
  163. return 240.0;
  164. } else {
  165. return 280.0;
  166. }
  167. }(),
  168. decoration: BoxDecoration(
  169. color: Colors.white,
  170. boxShadow: [
  171. BoxShadow(
  172. blurRadius: 4.0,
  173. color: Color(0x33000000),
  174. offset: Offset(
  175. 0.0,
  176. 2.0,
  177. ),
  178. )
  179. ],
  180. borderRadius: BorderRadius.only(
  181. topLeft: Radius.circular(12.0),
  182. topRight: Radius.circular(12.0),
  183. bottomLeft: Radius.circular(12.0),
  184. bottomRight: Radius.circular(12.0),
  185. ),
  186. ),
  187. child: Row(
  188. mainAxisSize: MainAxisSize.max,
  189. children: [
  190. Expanded(
  191. flex: 3,
  192. child: Container(
  193. decoration: BoxDecoration(
  194. color: FlutterFlowTheme.of(context)
  195. .secondaryBackground,
  196. ),
  197. child: Stack(
  198. children: [
  199. Align(
  200. alignment: AlignmentDirectional(0.0, 1.0),
  201. child: ClipRRect(
  202. borderRadius: BorderRadius.circular(8.0),
  203. child: CachedNetworkImage(
  204. fadeInDuration: Duration(milliseconds: 500),
  205. fadeOutDuration:
  206. Duration(milliseconds: 500),
  207. imageUrl: getJsonField(
  208. evenementenItem,
  209. r'''$.logo''',
  210. ).toString(),
  211. fit: BoxFit.fitHeight,
  212. ),
  213. ),
  214. ),
  215. Align(
  216. alignment: AlignmentDirectional(-0.92, 0.76),
  217. child: Padding(
  218. padding: EdgeInsetsDirectional.fromSTEB(
  219. 8.0, 4.0, 8.0, 4.0),
  220. child: Container(
  221. decoration: BoxDecoration(),
  222. child: Builder(
  223. builder: (context) {
  224. final categorieitem = getJsonField(
  225. evenementenItem,
  226. r'''$.categorie''',
  227. ).toList();
  228. _model.debugGeneratorVariables[
  229. 'categorieitem${categorieitem.length > 100 ? ' (first 100)' : ''}'] =
  230. debugSerializeParam(
  231. categorieitem.take(100),
  232. ParamType.JSON,
  233. isList: true,
  234. link:
  235. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=UitgaantabelKaartComponent',
  236. name: 'dynamic',
  237. nullable: false,
  238. );
  239. debugLogWidgetClass(_model);
  240. return Row(
  241. mainAxisSize: MainAxisSize.max,
  242. children: List.generate(
  243. categorieitem.length,
  244. (categorieitemIndex) {
  245. final categorieitemItem =
  246. categorieitem[
  247. categorieitemIndex];
  248. return Builder(builder: (_) {
  249. return DebugFlutterFlowModelContext(
  250. rootModel: _model.rootModel,
  251. parentModelCallback: (m) {
  252. _model.tagCategorieComponentModels[
  253. 'Keypvw_${categorieitemIndex}_of_${categorieitem.length}'] = m;
  254. },
  255. child:
  256. TagCategorieComponentWidget(
  257. key: Key(
  258. 'Keypvw_${categorieitemIndex}_of_${categorieitem.length}'),
  259. categorieTag:
  260. categorieitemItem
  261. .toString(),
  262. ),
  263. );
  264. });
  265. }),
  266. );
  267. },
  268. ),
  269. ),
  270. ),
  271. ),
  272. ],
  273. ),
  274. ),
  275. ),
  276. Expanded(
  277. flex: 6,
  278. child: Padding(
  279. padding: EdgeInsetsDirectional.fromSTEB(
  280. 6.0, 0.0, 0.0, 0.0),
  281. child: ClipRRect(
  282. child: Container(
  283. decoration: BoxDecoration(
  284. color: FlutterFlowTheme.of(context)
  285. .secondaryBackground,
  286. ),
  287. child: Align(
  288. alignment: AlignmentDirectional(-1.0, 0.0),
  289. child: Column(
  290. mainAxisSize: MainAxisSize.max,
  291. mainAxisAlignment: MainAxisAlignment.start,
  292. crossAxisAlignment: CrossAxisAlignment.start,
  293. children: [
  294. Padding(
  295. padding: EdgeInsetsDirectional.fromSTEB(
  296. 0.0, 0.0, 0.0, 5.0),
  297. child: AutoSizeText(
  298. getJsonField(
  299. evenementenItem,
  300. r'''$.titel''',
  301. ).toString(),
  302. style: FlutterFlowTheme.of(context)
  303. .bodyLarge
  304. .override(
  305. font: GoogleFonts.inter(
  306. fontWeight:
  307. FlutterFlowTheme.of(context)
  308. .bodyLarge
  309. .fontWeight,
  310. fontStyle:
  311. FlutterFlowTheme.of(context)
  312. .bodyLarge
  313. .fontStyle,
  314. ),
  315. letterSpacing: 0.0,
  316. fontWeight:
  317. FlutterFlowTheme.of(context)
  318. .bodyLarge
  319. .fontWeight,
  320. fontStyle:
  321. FlutterFlowTheme.of(context)
  322. .bodyLarge
  323. .fontStyle,
  324. shadows: [
  325. Shadow(
  326. color:
  327. FlutterFlowTheme.of(context)
  328. .secondaryText,
  329. offset: Offset(2.0, 2.0),
  330. blurRadius: 2.0,
  331. )
  332. ],
  333. ),
  334. overflow: TextOverflow.ellipsis,
  335. ),
  336. ),
  337. Row(
  338. mainAxisSize: MainAxisSize.max,
  339. children: [
  340. Padding(
  341. padding:
  342. EdgeInsetsDirectional.fromSTEB(
  343. 2.0, 0.0, 4.0, 0.0),
  344. child: Icon(
  345. Icons.add_business_rounded,
  346. color: FlutterFlowTheme.of(context)
  347. .primaryText,
  348. size: 20.0,
  349. ),
  350. ),
  351. Text(
  352. getJsonField(
  353. evenementenItem,
  354. r'''$.horecagelegenheid''',
  355. ).toString(),
  356. style: FlutterFlowTheme.of(context)
  357. .bodySmall
  358. .override(
  359. font: GoogleFonts.inter(
  360. fontWeight:
  361. FlutterFlowTheme.of(
  362. context)
  363. .bodySmall
  364. .fontWeight,
  365. fontStyle:
  366. FlutterFlowTheme.of(
  367. context)
  368. .bodySmall
  369. .fontStyle,
  370. ),
  371. letterSpacing: 0.0,
  372. fontWeight:
  373. FlutterFlowTheme.of(context)
  374. .bodySmall
  375. .fontWeight,
  376. fontStyle:
  377. FlutterFlowTheme.of(context)
  378. .bodySmall
  379. .fontStyle,
  380. ),
  381. ),
  382. ],
  383. ),
  384. Row(
  385. mainAxisSize: MainAxisSize.max,
  386. children: [
  387. Padding(
  388. padding:
  389. EdgeInsetsDirectional.fromSTEB(
  390. 2.0, 0.0, 4.0, 0.0),
  391. child: Icon(
  392. Icons.location_on_sharp,
  393. color: FlutterFlowTheme.of(context)
  394. .primaryText,
  395. size: 20.0,
  396. ),
  397. ),
  398. Text(
  399. getJsonField(
  400. evenementenItem,
  401. r'''$.adres''',
  402. ).toString(),
  403. style: FlutterFlowTheme.of(context)
  404. .bodySmall
  405. .override(
  406. font: GoogleFonts.inter(
  407. fontWeight:
  408. FlutterFlowTheme.of(
  409. context)
  410. .bodySmall
  411. .fontWeight,
  412. fontStyle:
  413. FlutterFlowTheme.of(
  414. context)
  415. .bodySmall
  416. .fontStyle,
  417. ),
  418. letterSpacing: 0.0,
  419. fontWeight:
  420. FlutterFlowTheme.of(context)
  421. .bodySmall
  422. .fontWeight,
  423. fontStyle:
  424. FlutterFlowTheme.of(context)
  425. .bodySmall
  426. .fontStyle,
  427. ),
  428. ),
  429. Text(
  430. FFLocalizations.of(context).getText(
  431. '4lehigdg' /* , */,
  432. ),
  433. style: FlutterFlowTheme.of(context)
  434. .bodyMedium
  435. .override(
  436. font: GoogleFonts.inter(
  437. fontWeight:
  438. FlutterFlowTheme.of(
  439. context)
  440. .bodyMedium
  441. .fontWeight,
  442. fontStyle:
  443. FlutterFlowTheme.of(
  444. context)
  445. .bodyMedium
  446. .fontStyle,
  447. ),
  448. letterSpacing: 0.0,
  449. fontWeight:
  450. FlutterFlowTheme.of(context)
  451. .bodyMedium
  452. .fontWeight,
  453. fontStyle:
  454. FlutterFlowTheme.of(context)
  455. .bodyMedium
  456. .fontStyle,
  457. ),
  458. ),
  459. Text(
  460. getJsonField(
  461. evenementenItem,
  462. r'''$.plaats''',
  463. ).toString(),
  464. style: FlutterFlowTheme.of(context)
  465. .bodySmall
  466. .override(
  467. font: GoogleFonts.inter(
  468. fontWeight:
  469. FlutterFlowTheme.of(
  470. context)
  471. .bodySmall
  472. .fontWeight,
  473. fontStyle:
  474. FlutterFlowTheme.of(
  475. context)
  476. .bodySmall
  477. .fontStyle,
  478. ),
  479. letterSpacing: 0.0,
  480. fontWeight:
  481. FlutterFlowTheme.of(context)
  482. .bodySmall
  483. .fontWeight,
  484. fontStyle:
  485. FlutterFlowTheme.of(context)
  486. .bodySmall
  487. .fontStyle,
  488. ),
  489. ),
  490. ],
  491. ),
  492. Row(
  493. mainAxisSize: MainAxisSize.max,
  494. children: [
  495. Padding(
  496. padding:
  497. EdgeInsetsDirectional.fromSTEB(
  498. 2.0, 0.0, 4.0, 0.0),
  499. child: Icon(
  500. Icons.calendar_month,
  501. color: FlutterFlowTheme.of(context)
  502. .primaryText,
  503. size: 20.0,
  504. ),
  505. ),
  506. Text(
  507. getJsonField(
  508. evenementenItem,
  509. r'''$.datum''',
  510. ).toString(),
  511. style: FlutterFlowTheme.of(context)
  512. .bodySmall
  513. .override(
  514. font: GoogleFonts.inter(
  515. fontWeight:
  516. FlutterFlowTheme.of(
  517. context)
  518. .bodySmall
  519. .fontWeight,
  520. fontStyle:
  521. FlutterFlowTheme.of(
  522. context)
  523. .bodySmall
  524. .fontStyle,
  525. ),
  526. letterSpacing: 0.0,
  527. fontWeight:
  528. FlutterFlowTheme.of(context)
  529. .bodySmall
  530. .fontWeight,
  531. fontStyle:
  532. FlutterFlowTheme.of(context)
  533. .bodySmall
  534. .fontStyle,
  535. ),
  536. ),
  537. ],
  538. ),
  539. Expanded(
  540. child: Text(
  541. getJsonField(
  542. evenementenItem,
  543. r'''$.inhoud''',
  544. ).toString(),
  545. textAlign: TextAlign.start,
  546. style: FlutterFlowTheme.of(context)
  547. .bodySmall
  548. .override(
  549. font: GoogleFonts.inter(
  550. fontWeight:
  551. FlutterFlowTheme.of(context)
  552. .bodySmall
  553. .fontWeight,
  554. fontStyle:
  555. FlutterFlowTheme.of(context)
  556. .bodySmall
  557. .fontStyle,
  558. ),
  559. letterSpacing: 0.0,
  560. fontWeight:
  561. FlutterFlowTheme.of(context)
  562. .bodySmall
  563. .fontWeight,
  564. fontStyle:
  565. FlutterFlowTheme.of(context)
  566. .bodySmall
  567. .fontStyle,
  568. ),
  569. overflow: TextOverflow.ellipsis,
  570. ),
  571. ),
  572. ],
  573. ),
  574. ),
  575. ),
  576. ),
  577. ),
  578. ),
  579. ],
  580. ),
  581. ),
  582. );
  583. },
  584. ),
  585. ),
  586. ),
  587. );
  588. }
  589. }