mijn_profiel_widget.dart 21 KB

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