mijn_profiel_widget.dart 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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 '/horecagelegenhedenoverzicht/horecagelegenheidoverzicht_kaart/horecagelegenheidoverzicht_kaart_widget.dart';
  7. import '/shared/drawer_component/drawer_component_widget.dart';
  8. import 'dart:ui';
  9. import '/index.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:provider/provider.dart';
  14. import 'mijn_profiel_model.dart';
  15. export 'mijn_profiel_model.dart';
  16. class MijnProfielWidget extends StatefulWidget {
  17. const MijnProfielWidget({super.key});
  18. static String routeName = 'mijnProfiel';
  19. static String routePath = '/mijnProfiel';
  20. @override
  21. State<MijnProfielWidget> createState() => _MijnProfielWidgetState();
  22. }
  23. class _MijnProfielWidgetState extends State<MijnProfielWidget> with RouteAware {
  24. late MijnProfielModel _model;
  25. final scaffoldKey = GlobalKey<ScaffoldState>();
  26. @override
  27. void initState() {
  28. super.initState();
  29. _model = createModel(context, () => MijnProfielModel());
  30. }
  31. @override
  32. void dispose() {
  33. routeObserver.unsubscribe(this);
  34. _model.dispose();
  35. super.dispose();
  36. }
  37. @override
  38. void didUpdateWidget(MijnProfielWidget oldWidget) {
  39. super.didUpdateWidget(oldWidget);
  40. _model.widget = widget;
  41. }
  42. @override
  43. void didChangeDependencies() {
  44. super.didChangeDependencies();
  45. final route = DebugModalRoute.of(context);
  46. if (route != null) {
  47. routeObserver.subscribe(this, route);
  48. }
  49. debugLogGlobalProperty(context);
  50. }
  51. @override
  52. void didPopNext() {
  53. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  54. setState(() => _model.isRouteVisible = true);
  55. debugLogWidgetClass(_model);
  56. }
  57. }
  58. @override
  59. void didPush() {
  60. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  61. setState(() => _model.isRouteVisible = true);
  62. debugLogWidgetClass(_model);
  63. }
  64. }
  65. @override
  66. void didPop() {
  67. _model.isRouteVisible = false;
  68. }
  69. @override
  70. void didPushNext() {
  71. _model.isRouteVisible = false;
  72. }
  73. @override
  74. Widget build(BuildContext context) {
  75. DebugFlutterFlowModelContext.maybeOf(context)
  76. ?.parentModelCallback
  77. ?.call(_model);
  78. context.watch<FFAppState>();
  79. _model.horecagelegenheidoverzichtKaartModels.clear();
  80. return GestureDetector(
  81. onTap: () {
  82. FocusScope.of(context).unfocus();
  83. FocusManager.instance.primaryFocus?.unfocus();
  84. },
  85. child: Scaffold(
  86. key: scaffoldKey,
  87. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  88. drawer: Drawer(
  89. elevation: 16.0,
  90. child: wrapWithModel(
  91. model: _model.drawerComponentModel,
  92. updateCallback: () => safeSetState(() {}),
  93. child: Builder(builder: (_) {
  94. return DebugFlutterFlowModelContext(
  95. rootModel: _model.rootModel,
  96. child: DrawerComponentWidget(),
  97. );
  98. }),
  99. ),
  100. ),
  101. appBar: PreferredSize(
  102. preferredSize: Size.fromHeight(80.0),
  103. child: AppBar(
  104. backgroundColor: FlutterFlowTheme.of(context).info,
  105. automaticallyImplyLeading: false,
  106. actions: [],
  107. flexibleSpace: FlexibleSpaceBar(
  108. background: wrapWithModel(
  109. model: _model.headerButtonsComponentModel,
  110. updateCallback: () => safeSetState(() {}),
  111. child: Builder(builder: (_) {
  112. return DebugFlutterFlowModelContext(
  113. rootModel: _model.rootModel,
  114. child: HeaderButtonsComponentWidget(
  115. showBackButton: true,
  116. ),
  117. );
  118. }),
  119. ),
  120. centerTitle: true,
  121. expandedTitleScale: 1.0,
  122. ),
  123. bottom: PreferredSize(
  124. preferredSize: Size.fromHeight(70.0),
  125. child: Container(),
  126. ),
  127. toolbarHeight: MediaQuery.sizeOf(context).height * 0.25,
  128. elevation: 2.0,
  129. ),
  130. ),
  131. body: SafeArea(
  132. top: true,
  133. child: SingleChildScrollView(
  134. child: Column(
  135. mainAxisSize: MainAxisSize.max,
  136. children: [
  137. Row(
  138. mainAxisSize: MainAxisSize.max,
  139. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  140. children: [
  141. Text(
  142. FFLocalizations.of(context).getText(
  143. 'aiokgolu' /* Mijn horecagelegenheden */,
  144. ),
  145. style: FlutterFlowTheme.of(context).titleMedium.override(
  146. font: GoogleFonts.roboto(
  147. fontWeight: FlutterFlowTheme.of(context)
  148. .titleMedium
  149. .fontWeight,
  150. fontStyle: FlutterFlowTheme.of(context)
  151. .titleMedium
  152. .fontStyle,
  153. ),
  154. letterSpacing: 0.0,
  155. fontWeight: FlutterFlowTheme.of(context)
  156. .titleMedium
  157. .fontWeight,
  158. fontStyle: FlutterFlowTheme.of(context)
  159. .titleMedium
  160. .fontStyle,
  161. ),
  162. ),
  163. FFButtonWidget(
  164. onPressed: () async {
  165. context.pushNamed(
  166. UitgaansevenementAanmakenWidget.routeName,
  167. queryParameters: {
  168. 'horecagelegenheidNid': serializeParam(
  169. '',
  170. ParamType.String,
  171. ),
  172. }.withoutNulls,
  173. );
  174. },
  175. text: FFLocalizations.of(context).getText(
  176. '8a7ti6zc' /* + Voeg toe */,
  177. ),
  178. options: FFButtonOptions(
  179. height: 40.0,
  180. padding: EdgeInsetsDirectional.fromSTEB(
  181. 16.0, 0.0, 16.0, 0.0),
  182. iconPadding:
  183. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
  184. color: FlutterFlowTheme.of(context).secondary,
  185. textStyle:
  186. FlutterFlowTheme.of(context).titleSmall.override(
  187. font: GoogleFonts.roboto(
  188. fontWeight: FlutterFlowTheme.of(context)
  189. .titleSmall
  190. .fontWeight,
  191. fontStyle: FlutterFlowTheme.of(context)
  192. .titleSmall
  193. .fontStyle,
  194. ),
  195. color: Colors.white,
  196. letterSpacing: 0.0,
  197. fontWeight: FlutterFlowTheme.of(context)
  198. .titleSmall
  199. .fontWeight,
  200. fontStyle: FlutterFlowTheme.of(context)
  201. .titleSmall
  202. .fontStyle,
  203. ),
  204. elevation: 0.0,
  205. borderRadius: BorderRadius.circular(8.0),
  206. ),
  207. ),
  208. ],
  209. ),
  210. Row(
  211. mainAxisSize: MainAxisSize.max,
  212. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  213. children: [
  214. Text(
  215. FFLocalizations.of(context).getText(
  216. '5iw84w8w' /* Mijn redactierechten */,
  217. ),
  218. style: FlutterFlowTheme.of(context).titleMedium.override(
  219. font: GoogleFonts.roboto(
  220. fontWeight: FlutterFlowTheme.of(context)
  221. .titleMedium
  222. .fontWeight,
  223. fontStyle: FlutterFlowTheme.of(context)
  224. .titleMedium
  225. .fontStyle,
  226. ),
  227. letterSpacing: 0.0,
  228. fontWeight: FlutterFlowTheme.of(context)
  229. .titleMedium
  230. .fontWeight,
  231. fontStyle: FlutterFlowTheme.of(context)
  232. .titleMedium
  233. .fontStyle,
  234. ),
  235. ),
  236. FFButtonWidget(
  237. onPressed: () async {
  238. context
  239. .pushNamed(StadsactiviteitAanmakenWidget.routeName);
  240. },
  241. text: FFLocalizations.of(context).getText(
  242. 'h3caw9re' /* + Voeg toe */,
  243. ),
  244. options: FFButtonOptions(
  245. height: 40.0,
  246. padding: EdgeInsetsDirectional.fromSTEB(
  247. 16.0, 0.0, 16.0, 0.0),
  248. iconPadding:
  249. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
  250. color: FlutterFlowTheme.of(context).secondary,
  251. textStyle:
  252. FlutterFlowTheme.of(context).titleSmall.override(
  253. font: GoogleFonts.roboto(
  254. fontWeight: FlutterFlowTheme.of(context)
  255. .titleSmall
  256. .fontWeight,
  257. fontStyle: FlutterFlowTheme.of(context)
  258. .titleSmall
  259. .fontStyle,
  260. ),
  261. color: Colors.white,
  262. letterSpacing: 0.0,
  263. fontWeight: FlutterFlowTheme.of(context)
  264. .titleSmall
  265. .fontWeight,
  266. fontStyle: FlutterFlowTheme.of(context)
  267. .titleSmall
  268. .fontStyle,
  269. ),
  270. elevation: 0.0,
  271. borderRadius: BorderRadius.circular(8.0),
  272. ),
  273. ),
  274. ],
  275. ),
  276. FutureBuilder<ApiCallResponse>(
  277. future: MijnHorecagelegenhedenCall.call(
  278. sessionName: FFAppState().userSessionname,
  279. sessid: FFAppState().userSessionid,
  280. ),
  281. builder: (context, snapshot) {
  282. // Customize what your widget looks like when it's loading.
  283. if (!snapshot.hasData) {
  284. return Center(
  285. child: SizedBox(
  286. width: 80.0,
  287. height: 80.0,
  288. child: SpinKitFadingCircle(
  289. color: FlutterFlowTheme.of(context).primary,
  290. size: 80.0,
  291. ),
  292. ),
  293. );
  294. }
  295. final listViewMijnHorecagelegenhedenResponse =
  296. snapshot.data!;
  297. _model.debugBackendQueries[
  298. 'MijnHorecagelegenhedenCall_statusCode_ListView_gxiuys53'] =
  299. debugSerializeParam(
  300. listViewMijnHorecagelegenhedenResponse.statusCode,
  301. ParamType.int,
  302. link:
  303. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  304. name: 'int',
  305. nullable: false,
  306. );
  307. _model.debugBackendQueries[
  308. 'MijnHorecagelegenhedenCall_responseBody_ListView_gxiuys53'] =
  309. debugSerializeParam(
  310. listViewMijnHorecagelegenhedenResponse.bodyText,
  311. ParamType.String,
  312. link:
  313. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  314. name: 'String',
  315. nullable: false,
  316. );
  317. debugLogWidgetClass(_model);
  318. return Builder(
  319. builder: (context) {
  320. final horecaItem =
  321. listViewMijnHorecagelegenhedenResponse.jsonBody
  322. .toList();
  323. _model.debugGeneratorVariables[
  324. 'horecaItem${horecaItem.length > 100 ? ' (first 100)' : ''}'] =
  325. debugSerializeParam(
  326. horecaItem.take(100),
  327. ParamType.JSON,
  328. isList: true,
  329. link:
  330. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  331. name: 'dynamic',
  332. nullable: false,
  333. );
  334. debugLogWidgetClass(_model);
  335. return ListView.builder(
  336. padding: EdgeInsets.zero,
  337. shrinkWrap: true,
  338. scrollDirection: Axis.vertical,
  339. itemCount: horecaItem.length,
  340. itemBuilder: (context, horecaItemIndex) {
  341. final horecaItemItem = horecaItem[horecaItemIndex];
  342. return Builder(builder: (_) {
  343. return DebugFlutterFlowModelContext(
  344. rootModel: _model.rootModel,
  345. parentModelCallback: (m) {
  346. _model.horecagelegenheidoverzichtKaartModels[
  347. 'Key4vp_${horecaItemIndex}_of_${horecaItem.length}'] = m;
  348. },
  349. child: HorecagelegenheidoverzichtKaartWidget(
  350. key: Key(
  351. 'Key4vp_${horecaItemIndex}_of_${horecaItem.length}'),
  352. titel: getJsonField(
  353. horecaItemItem,
  354. r'''$.titel''',
  355. ).toString(),
  356. logo: getJsonField(
  357. horecaItemItem,
  358. r'''$.logo''',
  359. ).toString(),
  360. nid: getJsonField(
  361. horecaItemItem,
  362. r'''$.nid''',
  363. ).toString(),
  364. adres: getJsonField(
  365. horecaItemItem,
  366. r'''$.adres''',
  367. ).toString(),
  368. plaats: getJsonField(
  369. horecaItemItem,
  370. r'''$.plaats''',
  371. ).toString(),
  372. categorie: (getJsonField(
  373. horecaItemItem,
  374. r'''$.categorie''',
  375. true,
  376. ) as List?)
  377. ?.map<String>((e) => e.toString())
  378. .toList()
  379. .cast<String>(),
  380. ),
  381. );
  382. });
  383. },
  384. );
  385. },
  386. );
  387. },
  388. ),
  389. FutureBuilder<ApiCallResponse>(
  390. future: MijnStadsrechtenCall.call(
  391. sessionName: FFAppState().userSessionname,
  392. sessid: FFAppState().userSessionid,
  393. ),
  394. builder: (context, snapshot) {
  395. // Customize what your widget looks like when it's loading.
  396. if (!snapshot.hasData) {
  397. return Center(
  398. child: SizedBox(
  399. width: 80.0,
  400. height: 80.0,
  401. child: SpinKitFadingCircle(
  402. color: FlutterFlowTheme.of(context).primary,
  403. size: 80.0,
  404. ),
  405. ),
  406. );
  407. }
  408. final listViewMijnStadsrechtenResponse = snapshot.data!;
  409. _model.debugBackendQueries[
  410. 'MijnStadsrechtenCall_statusCode_ListView_m1osuvrr'] =
  411. debugSerializeParam(
  412. listViewMijnStadsrechtenResponse.statusCode,
  413. ParamType.int,
  414. link:
  415. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  416. name: 'int',
  417. nullable: false,
  418. );
  419. _model.debugBackendQueries[
  420. 'MijnStadsrechtenCall_responseBody_ListView_m1osuvrr'] =
  421. debugSerializeParam(
  422. listViewMijnStadsrechtenResponse.bodyText,
  423. ParamType.String,
  424. link:
  425. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  426. name: 'String',
  427. nullable: false,
  428. );
  429. debugLogWidgetClass(_model);
  430. return Builder(
  431. builder: (context) {
  432. final rechtItem =
  433. listViewMijnStadsrechtenResponse.jsonBody.toList();
  434. _model.debugGeneratorVariables[
  435. 'rechtItem${rechtItem.length > 100 ? ' (first 100)' : ''}'] =
  436. debugSerializeParam(
  437. rechtItem.take(100),
  438. ParamType.JSON,
  439. isList: true,
  440. link:
  441. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  442. name: 'dynamic',
  443. nullable: false,
  444. );
  445. debugLogWidgetClass(_model);
  446. return ListView.builder(
  447. padding: EdgeInsets.zero,
  448. shrinkWrap: true,
  449. scrollDirection: Axis.vertical,
  450. itemCount: rechtItem.length,
  451. itemBuilder: (context, rechtItemIndex) {
  452. final rechtItemItem = rechtItem[rechtItemIndex];
  453. return Column(
  454. mainAxisSize: MainAxisSize.max,
  455. children: [
  456. Text(
  457. '${getJsonField(
  458. rechtItemItem,
  459. r'''$.titel''',
  460. ).toString()} — ${getJsonField(
  461. rechtItemItem,
  462. r'''$.parent_titel''',
  463. ).toString()}',
  464. style: FlutterFlowTheme.of(context)
  465. .bodyMedium
  466. .override(
  467. font: GoogleFonts.roboto(
  468. fontWeight:
  469. FlutterFlowTheme.of(context)
  470. .bodyMedium
  471. .fontWeight,
  472. fontStyle:
  473. FlutterFlowTheme.of(context)
  474. .bodyMedium
  475. .fontStyle,
  476. ),
  477. letterSpacing: 0.0,
  478. fontWeight: FlutterFlowTheme.of(context)
  479. .bodyMedium
  480. .fontWeight,
  481. fontStyle: FlutterFlowTheme.of(context)
  482. .bodyMedium
  483. .fontStyle,
  484. ),
  485. ),
  486. ],
  487. );
  488. },
  489. );
  490. },
  491. );
  492. },
  493. ),
  494. ],
  495. ),
  496. ),
  497. ),
  498. ),
  499. );
  500. }
  501. }