mijn_aanmeldingen_widget.dart 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. import '/backend/api_requests/api_calls.dart';
  2. import '/components/header_buttons_component_widget.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 '/shared/drawer_component/drawer_component_widget.dart';
  7. import '/shared/lege_lijst_melding/lege_lijst_melding_widget.dart';
  8. import 'dart:ui';
  9. import '/flutter_flow/custom_functions.dart' as functions;
  10. import '/index.dart';
  11. import 'package:aligned_tooltip/aligned_tooltip.dart';
  12. import 'package:flutter/material.dart';
  13. import 'package:flutter_spinkit/flutter_spinkit.dart';
  14. import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
  15. import 'package:google_fonts/google_fonts.dart';
  16. import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
  17. import 'package:provider/provider.dart';
  18. import 'mijn_aanmeldingen_model.dart';
  19. export 'mijn_aanmeldingen_model.dart';
  20. class MijnAanmeldingenWidget extends StatefulWidget {
  21. const MijnAanmeldingenWidget({
  22. super.key,
  23. this.type,
  24. });
  25. final String? type;
  26. static String routeName = 'MijnAanmeldingen';
  27. static String routePath = '/mijnAanmeldingen';
  28. @override
  29. State<MijnAanmeldingenWidget> createState() => _MijnAanmeldingenWidgetState();
  30. }
  31. class _MijnAanmeldingenWidgetState extends State<MijnAanmeldingenWidget>
  32. with RouteAware {
  33. late MijnAanmeldingenModel _model;
  34. final scaffoldKey = GlobalKey<ScaffoldState>();
  35. @override
  36. void initState() {
  37. super.initState();
  38. _model = createModel(context, () => MijnAanmeldingenModel());
  39. }
  40. @override
  41. void dispose() {
  42. routeObserver.unsubscribe(this);
  43. _model.dispose();
  44. super.dispose();
  45. }
  46. @override
  47. void didUpdateWidget(MijnAanmeldingenWidget oldWidget) {
  48. super.didUpdateWidget(oldWidget);
  49. _model.widget = widget;
  50. }
  51. @override
  52. void didChangeDependencies() {
  53. super.didChangeDependencies();
  54. final route = DebugModalRoute.of(context);
  55. if (route != null) {
  56. routeObserver.subscribe(this, route);
  57. }
  58. debugLogGlobalProperty(context);
  59. }
  60. @override
  61. void didPopNext() {
  62. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  63. setState(() => _model.isRouteVisible = true);
  64. debugLogWidgetClass(_model);
  65. }
  66. }
  67. @override
  68. void didPush() {
  69. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  70. setState(() => _model.isRouteVisible = true);
  71. debugLogWidgetClass(_model);
  72. }
  73. }
  74. @override
  75. void didPop() {
  76. _model.isRouteVisible = false;
  77. }
  78. @override
  79. void didPushNext() {
  80. _model.isRouteVisible = false;
  81. }
  82. @override
  83. Widget build(BuildContext context) {
  84. DebugFlutterFlowModelContext.maybeOf(context)
  85. ?.parentModelCallback
  86. ?.call(_model);
  87. context.watch<FFAppState>();
  88. return GestureDetector(
  89. onTap: () {
  90. FocusScope.of(context).unfocus();
  91. FocusManager.instance.primaryFocus?.unfocus();
  92. },
  93. child: Scaffold(
  94. key: scaffoldKey,
  95. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  96. drawer: Drawer(
  97. elevation: 16.0,
  98. child: wrapWithModel(
  99. model: _model.drawerComponentModel,
  100. updateCallback: () => safeSetState(() {}),
  101. child: Builder(builder: (_) {
  102. return DebugFlutterFlowModelContext(
  103. rootModel: _model.rootModel,
  104. child: DrawerComponentWidget(),
  105. );
  106. }),
  107. ),
  108. ),
  109. appBar: PreferredSize(
  110. preferredSize: Size.fromHeight(80.0),
  111. child: AppBar(
  112. backgroundColor: FlutterFlowTheme.of(context).primaryText,
  113. automaticallyImplyLeading: false,
  114. actions: [],
  115. flexibleSpace: FlexibleSpaceBar(
  116. background: wrapWithModel(
  117. model: _model.headerButtonsComponentModel,
  118. updateCallback: () => safeSetState(() {}),
  119. child: Builder(builder: (_) {
  120. return DebugFlutterFlowModelContext(
  121. rootModel: _model.rootModel,
  122. child: HeaderButtonsComponentWidget(
  123. showBackButton: true,
  124. landelijk: false,
  125. ),
  126. );
  127. }),
  128. ),
  129. centerTitle: true,
  130. expandedTitleScale: 1.0,
  131. ),
  132. bottom: PreferredSize(
  133. preferredSize: Size.fromHeight(70.0),
  134. child: Container(),
  135. ),
  136. toolbarHeight: MediaQuery.sizeOf(context).height * 0.25,
  137. elevation: 2.0,
  138. ),
  139. ),
  140. body: SafeArea(
  141. top: true,
  142. child: Column(
  143. mainAxisSize: MainAxisSize.max,
  144. children: [
  145. Expanded(
  146. child: PagedMasonryGridView<ApiPagingParams, dynamic>.count(
  147. pagingController: _model.setStaggeredViewController(
  148. (nextPageMarker) => MijnAanmeldingenCall.call(
  149. sessionName: FFAppState().userSessionname,
  150. sessid: FFAppState().userSessionid,
  151. page: nextPageMarker.nextPageNumber,
  152. type: widget!.type,
  153. ),
  154. ),
  155. crossAxisCount: () {
  156. if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
  157. return 1;
  158. } else if (MediaQuery.sizeOf(context).width <
  159. kBreakpointMedium) {
  160. return 1;
  161. } else if (MediaQuery.sizeOf(context).width <
  162. kBreakpointLarge) {
  163. return 2;
  164. } else {
  165. return 3;
  166. }
  167. }(),
  168. crossAxisSpacing: 10.0,
  169. mainAxisSpacing: 10.0,
  170. builderDelegate: PagedChildBuilderDelegate<dynamic>(
  171. // Customize what your widget looks like when it's loading the first page.
  172. firstPageProgressIndicatorBuilder: (_) => Center(
  173. child: SizedBox(
  174. width: 80.0,
  175. height: 80.0,
  176. child: SpinKitFadingCircle(
  177. color: FlutterFlowTheme.of(context).primary,
  178. size: 80.0,
  179. ),
  180. ),
  181. ),
  182. // Customize what your widget looks like when it's loading another page.
  183. newPageProgressIndicatorBuilder: (_) => Center(
  184. child: SizedBox(
  185. width: 80.0,
  186. height: 80.0,
  187. child: SpinKitFadingCircle(
  188. color: FlutterFlowTheme.of(context).primary,
  189. size: 80.0,
  190. ),
  191. ),
  192. ),
  193. noItemsFoundIndicatorBuilder: (_) => Center(
  194. child: LegeLijstMeldingWidget(
  195. nlTekst:
  196. 'Je hebt nog geen komende evenementen of activiteiten aangemaakt.',
  197. enTekst:
  198. 'You haven\'t created any upcoming events or activities yet.',
  199. ),
  200. ),
  201. itemBuilder: (context, _, aanmeldingItemIndex) {
  202. final aanmeldingItemItem = _model
  203. .staggeredViewPagingController!
  204. .itemList![aanmeldingItemIndex];
  205. return Padding(
  206. padding: EdgeInsets.all(12.0),
  207. child: Container(
  208. decoration: BoxDecoration(
  209. color: FlutterFlowTheme.of(context)
  210. .secondaryBackground,
  211. borderRadius: BorderRadius.circular(8.0),
  212. ),
  213. child: Column(
  214. mainAxisSize: MainAxisSize.max,
  215. children: [
  216. Padding(
  217. padding: EdgeInsets.all(12.0),
  218. child: InkWell(
  219. splashColor: Colors.transparent,
  220. focusColor: Colors.transparent,
  221. hoverColor: Colors.transparent,
  222. highlightColor: Colors.transparent,
  223. onTap: () async {
  224. if (functions
  225. .isOngepubliceerd(aanmeldingItemItem)) {
  226. ScaffoldMessenger.of(context)
  227. .showSnackBar(
  228. SnackBar(
  229. content: Text(
  230. 'Dit item staat nog in beoordeling en is nog niet online.',
  231. style: TextStyle(
  232. color:
  233. FlutterFlowTheme.of(context)
  234. .primaryText,
  235. ),
  236. ),
  237. duration:
  238. Duration(milliseconds: 4000),
  239. backgroundColor:
  240. FlutterFlowTheme.of(context)
  241. .secondary,
  242. ),
  243. );
  244. } else {
  245. context.pushNamed(
  246. EventCurrentWidget.routeName,
  247. queryParameters: {
  248. 'nid': serializeParam(
  249. getJsonField(
  250. aanmeldingItemItem,
  251. r'''$.nid''',
  252. ).toString(),
  253. ParamType.String,
  254. ),
  255. 'horecaid': serializeParam(
  256. getJsonField(
  257. aanmeldingItemItem,
  258. r'''$.horecagelegenheidnid''',
  259. ).toString(),
  260. ParamType.String,
  261. ),
  262. }.withoutNulls,
  263. );
  264. }
  265. },
  266. child: Column(
  267. mainAxisSize: MainAxisSize.max,
  268. children: [
  269. if (getJsonField(
  270. aanmeldingItemItem,
  271. r'''$.logo''',
  272. ) !=
  273. null)
  274. ClipRRect(
  275. borderRadius:
  276. BorderRadius.circular(8.0),
  277. child: Image.network(
  278. getJsonField(
  279. aanmeldingItemItem,
  280. r'''$.logo''',
  281. ).toString(),
  282. width: double.infinity,
  283. height: 120.0,
  284. fit: BoxFit.cover,
  285. ),
  286. ),
  287. Text(
  288. getJsonField(
  289. aanmeldingItemItem,
  290. r'''$.title''',
  291. ).toString(),
  292. style: FlutterFlowTheme.of(context)
  293. .bodyMedium
  294. .override(
  295. font: GoogleFonts.roboto(
  296. fontWeight:
  297. FlutterFlowTheme.of(context)
  298. .bodyMedium
  299. .fontWeight,
  300. fontStyle:
  301. FlutterFlowTheme.of(context)
  302. .bodyMedium
  303. .fontStyle,
  304. ),
  305. letterSpacing: 0.0,
  306. fontWeight:
  307. FlutterFlowTheme.of(context)
  308. .bodyMedium
  309. .fontWeight,
  310. fontStyle:
  311. FlutterFlowTheme.of(context)
  312. .bodyMedium
  313. .fontStyle,
  314. ),
  315. ),
  316. Text(
  317. getJsonField(
  318. aanmeldingItemItem,
  319. r'''$.datum_start''',
  320. ).toString(),
  321. style: FlutterFlowTheme.of(context)
  322. .bodyMedium
  323. .override(
  324. font: GoogleFonts.roboto(
  325. fontWeight:
  326. FlutterFlowTheme.of(context)
  327. .bodyMedium
  328. .fontWeight,
  329. fontStyle:
  330. FlutterFlowTheme.of(context)
  331. .bodyMedium
  332. .fontStyle,
  333. ),
  334. letterSpacing: 0.0,
  335. fontWeight:
  336. FlutterFlowTheme.of(context)
  337. .bodyMedium
  338. .fontWeight,
  339. fontStyle:
  340. FlutterFlowTheme.of(context)
  341. .bodyMedium
  342. .fontStyle,
  343. ),
  344. ),
  345. Text(
  346. getJsonField(
  347. aanmeldingItemItem,
  348. r'''$.status_label''',
  349. ).toString(),
  350. style: FlutterFlowTheme.of(context)
  351. .bodyMedium
  352. .override(
  353. font: GoogleFonts.roboto(
  354. fontWeight:
  355. FlutterFlowTheme.of(context)
  356. .bodyMedium
  357. .fontWeight,
  358. fontStyle:
  359. FlutterFlowTheme.of(context)
  360. .bodyMedium
  361. .fontStyle,
  362. ),
  363. letterSpacing: 0.0,
  364. fontWeight:
  365. FlutterFlowTheme.of(context)
  366. .bodyMedium
  367. .fontWeight,
  368. fontStyle:
  369. FlutterFlowTheme.of(context)
  370. .bodyMedium
  371. .fontStyle,
  372. ),
  373. ),
  374. ],
  375. ),
  376. ),
  377. ),
  378. Align(
  379. alignment: AlignmentDirectional(1.0, 0.0),
  380. child: AlignedTooltip(
  381. content: Padding(
  382. padding: EdgeInsets.all(4.0),
  383. child: Text(
  384. FFLocalizations.of(context).getText(
  385. 'q8einmt3' /* Kopieer naar een nieuw eveneme... */,
  386. ),
  387. style: FlutterFlowTheme.of(context)
  388. .bodyLarge
  389. .override(
  390. font: GoogleFonts.roboto(
  391. fontWeight:
  392. FlutterFlowTheme.of(context)
  393. .bodyLarge
  394. .fontWeight,
  395. fontStyle:
  396. FlutterFlowTheme.of(context)
  397. .bodyLarge
  398. .fontStyle,
  399. ),
  400. letterSpacing: 0.0,
  401. fontWeight:
  402. FlutterFlowTheme.of(context)
  403. .bodyLarge
  404. .fontWeight,
  405. fontStyle:
  406. FlutterFlowTheme.of(context)
  407. .bodyLarge
  408. .fontStyle,
  409. ),
  410. ),
  411. ),
  412. offset: 4.0,
  413. preferredDirection: AxisDirection.down,
  414. borderRadius: BorderRadius.circular(8.0),
  415. backgroundColor: FlutterFlowTheme.of(context)
  416. .secondaryBackground,
  417. elevation: 4.0,
  418. tailBaseWidth: 24.0,
  419. tailLength: 12.0,
  420. waitDuration: Duration(milliseconds: 100),
  421. showDuration: Duration(milliseconds: 1500),
  422. triggerMode: TooltipTriggerMode.longPress,
  423. child: Padding(
  424. padding: EdgeInsetsDirectional.fromSTEB(
  425. 0.0, 0.0, 12.0, 0.0),
  426. child: FFButtonWidget(
  427. onPressed: () async {
  428. _model.apiResulttzz =
  429. await AanmeldingKloonbronCall.call(
  430. sessionName:
  431. FFAppState().userSessionname,
  432. sessid: FFAppState().userSessionid,
  433. nid: getJsonField(
  434. aanmeldingItemItem,
  435. r'''$.nid''',
  436. ).toString(),
  437. );
  438. if ((_model.apiResulttzz?.succeeded ??
  439. true)) {
  440. FFAppState().kloonBron =
  441. (_model.apiResulttzz?.jsonBody ??
  442. '');
  443. safeSetState(() {});
  444. if (widget!.type == 'go_out_event') {
  445. context.pushNamed(
  446. UitgaansevenementAanmakenWidget
  447. .routeName,
  448. queryParameters: {
  449. 'horecagelegenheidNid':
  450. serializeParam(
  451. getJsonField(
  452. aanmeldingItemItem,
  453. r'''$.horecagelegenheidnid''',
  454. ).toString(),
  455. ParamType.String,
  456. ),
  457. }.withoutNulls,
  458. );
  459. } else {
  460. context.pushNamed(
  461. StadsactiviteitAanmakenWidget
  462. .routeName,
  463. queryParameters: {
  464. 'gemeenteTid': serializeParam(
  465. getJsonField(
  466. (_model.apiResulttzz
  467. ?.jsonBody ??
  468. ''),
  469. r'''$.gemeente_tid''',
  470. ).toString(),
  471. ParamType.String,
  472. ),
  473. }.withoutNulls,
  474. );
  475. }
  476. }
  477. safeSetState(() {});
  478. },
  479. text: FFLocalizations.of(context).getText(
  480. 'g4pbs1et' /* Kopie */,
  481. ),
  482. icon: Icon(
  483. Icons.content_copy,
  484. size: 14.0,
  485. ),
  486. options: FFButtonOptions(
  487. height: 28.0,
  488. padding: EdgeInsetsDirectional.fromSTEB(
  489. 10.0, 0.0, 10.0, 0.0),
  490. iconPadding:
  491. EdgeInsetsDirectional.fromSTEB(
  492. 0.0, 0.0, 4.0, 0.0),
  493. iconColor: FlutterFlowTheme.of(context)
  494. .secondary,
  495. color: FlutterFlowTheme.of(context)
  496. .secondaryBackground,
  497. textStyle: FlutterFlowTheme.of(context)
  498. .bodySmall
  499. .override(
  500. font: GoogleFonts.roboto(
  501. fontWeight:
  502. FlutterFlowTheme.of(context)
  503. .bodySmall
  504. .fontWeight,
  505. fontStyle:
  506. FlutterFlowTheme.of(context)
  507. .bodySmall
  508. .fontStyle,
  509. ),
  510. color:
  511. FlutterFlowTheme.of(context)
  512. .secondary,
  513. letterSpacing: 0.0,
  514. fontWeight:
  515. FlutterFlowTheme.of(context)
  516. .bodySmall
  517. .fontWeight,
  518. fontStyle:
  519. FlutterFlowTheme.of(context)
  520. .bodySmall
  521. .fontStyle,
  522. ),
  523. elevation: 0.0,
  524. borderSide: BorderSide(
  525. color: FlutterFlowTheme.of(context)
  526. .secondary,
  527. width: 1.0,
  528. ),
  529. borderRadius:
  530. BorderRadius.circular(14.0),
  531. ),
  532. ),
  533. ),
  534. ),
  535. ),
  536. ],
  537. ),
  538. ),
  539. );
  540. },
  541. ),
  542. ),
  543. ),
  544. ],
  545. ),
  546. ),
  547. ),
  548. );
  549. }
  550. }