mijn_profiel_widget.dart 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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. context
  201. .pushNamed(StadsactiviteitAanmakenWidget.routeName);
  202. },
  203. text: FFLocalizations.of(context).getText(
  204. 'h3caw9re' /* + Voeg toe */,
  205. ),
  206. options: FFButtonOptions(
  207. height: 40.0,
  208. padding: EdgeInsetsDirectional.fromSTEB(
  209. 16.0, 0.0, 16.0, 0.0),
  210. iconPadding:
  211. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
  212. color: FlutterFlowTheme.of(context).secondary,
  213. textStyle:
  214. FlutterFlowTheme.of(context).titleSmall.override(
  215. font: GoogleFonts.roboto(
  216. fontWeight: FlutterFlowTheme.of(context)
  217. .titleSmall
  218. .fontWeight,
  219. fontStyle: FlutterFlowTheme.of(context)
  220. .titleSmall
  221. .fontStyle,
  222. ),
  223. color: Colors.white,
  224. letterSpacing: 0.0,
  225. fontWeight: FlutterFlowTheme.of(context)
  226. .titleSmall
  227. .fontWeight,
  228. fontStyle: FlutterFlowTheme.of(context)
  229. .titleSmall
  230. .fontStyle,
  231. ),
  232. elevation: 0.0,
  233. borderRadius: BorderRadius.circular(8.0),
  234. ),
  235. ),
  236. ],
  237. ),
  238. FutureBuilder<ApiCallResponse>(
  239. future: MijnHorecagelegenhedenCall.call(
  240. sessionName: FFAppState().userSessionname,
  241. sessid: FFAppState().userSessionid,
  242. ),
  243. builder: (context, snapshot) {
  244. // Customize what your widget looks like when it's loading.
  245. if (!snapshot.hasData) {
  246. return Center(
  247. child: SizedBox(
  248. width: 80.0,
  249. height: 80.0,
  250. child: SpinKitFadingCircle(
  251. color: FlutterFlowTheme.of(context).primary,
  252. size: 80.0,
  253. ),
  254. ),
  255. );
  256. }
  257. final listViewMijnHorecagelegenhedenResponse =
  258. snapshot.data!;
  259. _model.debugBackendQueries[
  260. 'MijnHorecagelegenhedenCall_statusCode_ListView_gxiuys53'] =
  261. debugSerializeParam(
  262. listViewMijnHorecagelegenhedenResponse.statusCode,
  263. ParamType.int,
  264. link:
  265. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  266. name: 'int',
  267. nullable: false,
  268. );
  269. _model.debugBackendQueries[
  270. 'MijnHorecagelegenhedenCall_responseBody_ListView_gxiuys53'] =
  271. debugSerializeParam(
  272. listViewMijnHorecagelegenhedenResponse.bodyText,
  273. ParamType.String,
  274. link:
  275. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  276. name: 'String',
  277. nullable: false,
  278. );
  279. debugLogWidgetClass(_model);
  280. return Builder(
  281. builder: (context) {
  282. final horecaItem =
  283. listViewMijnHorecagelegenhedenResponse.jsonBody
  284. .toList();
  285. _model.debugGeneratorVariables[
  286. 'horecaItem${horecaItem.length > 100 ? ' (first 100)' : ''}'] =
  287. debugSerializeParam(
  288. horecaItem.take(100),
  289. ParamType.JSON,
  290. isList: true,
  291. link:
  292. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  293. name: 'dynamic',
  294. nullable: false,
  295. );
  296. debugLogWidgetClass(_model);
  297. return ListView.builder(
  298. padding: EdgeInsets.zero,
  299. shrinkWrap: true,
  300. scrollDirection: Axis.vertical,
  301. itemCount: horecaItem.length,
  302. itemBuilder: (context, horecaItemIndex) {
  303. final horecaItemItem = horecaItem[horecaItemIndex];
  304. return Builder(builder: (_) {
  305. return DebugFlutterFlowModelContext(
  306. rootModel: _model.rootModel,
  307. parentModelCallback: (m) {
  308. _model.horecagelegenheidoverzichtKaartModels[
  309. 'Key4vp_${horecaItemIndex}_of_${horecaItem.length}'] = m;
  310. },
  311. child: HorecagelegenheidoverzichtKaartWidget(
  312. key: Key(
  313. 'Key4vp_${horecaItemIndex}_of_${horecaItem.length}'),
  314. titel: getJsonField(
  315. horecaItemItem,
  316. r'''$.titel''',
  317. ).toString(),
  318. logo: getJsonField(
  319. horecaItemItem,
  320. r'''$.logo''',
  321. ).toString(),
  322. nid: getJsonField(
  323. horecaItemItem,
  324. r'''$.nid''',
  325. ).toString(),
  326. adres: getJsonField(
  327. horecaItemItem,
  328. r'''$.adres''',
  329. ).toString(),
  330. plaats: getJsonField(
  331. horecaItemItem,
  332. r'''$.plaats''',
  333. ).toString(),
  334. categorie: (getJsonField(
  335. horecaItemItem,
  336. r'''$.categorie''',
  337. true,
  338. ) as List?)
  339. ?.map<String>((e) => e.toString())
  340. .toList()
  341. .cast<String>(),
  342. ),
  343. );
  344. });
  345. },
  346. );
  347. },
  348. );
  349. },
  350. ),
  351. FutureBuilder<ApiCallResponse>(
  352. future: MijnStadsrechtenCall.call(
  353. sessionName: FFAppState().userSessionname,
  354. sessid: FFAppState().userSessionid,
  355. ),
  356. builder: (context, snapshot) {
  357. // Customize what your widget looks like when it's loading.
  358. if (!snapshot.hasData) {
  359. return Center(
  360. child: SizedBox(
  361. width: 80.0,
  362. height: 80.0,
  363. child: SpinKitFadingCircle(
  364. color: FlutterFlowTheme.of(context).primary,
  365. size: 80.0,
  366. ),
  367. ),
  368. );
  369. }
  370. final listViewMijnStadsrechtenResponse = snapshot.data!;
  371. _model.debugBackendQueries[
  372. 'MijnStadsrechtenCall_statusCode_ListView_m1osuvrr'] =
  373. debugSerializeParam(
  374. listViewMijnStadsrechtenResponse.statusCode,
  375. ParamType.int,
  376. link:
  377. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  378. name: 'int',
  379. nullable: false,
  380. );
  381. _model.debugBackendQueries[
  382. 'MijnStadsrechtenCall_responseBody_ListView_m1osuvrr'] =
  383. debugSerializeParam(
  384. listViewMijnStadsrechtenResponse.bodyText,
  385. ParamType.String,
  386. link:
  387. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  388. name: 'String',
  389. nullable: false,
  390. );
  391. debugLogWidgetClass(_model);
  392. return Builder(
  393. builder: (context) {
  394. final rechtItem =
  395. listViewMijnStadsrechtenResponse.jsonBody.toList();
  396. _model.debugGeneratorVariables[
  397. 'rechtItem${rechtItem.length > 100 ? ' (first 100)' : ''}'] =
  398. debugSerializeParam(
  399. rechtItem.take(100),
  400. ParamType.JSON,
  401. isList: true,
  402. link:
  403. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=mijnProfiel',
  404. name: 'dynamic',
  405. nullable: false,
  406. );
  407. debugLogWidgetClass(_model);
  408. return ListView.builder(
  409. padding: EdgeInsets.zero,
  410. shrinkWrap: true,
  411. scrollDirection: Axis.vertical,
  412. itemCount: rechtItem.length,
  413. itemBuilder: (context, rechtItemIndex) {
  414. final rechtItemItem = rechtItem[rechtItemIndex];
  415. return Column(
  416. mainAxisSize: MainAxisSize.max,
  417. children: [
  418. Text(
  419. '${getJsonField(
  420. rechtItemItem,
  421. r'''$.titel''',
  422. ).toString()} — ${getJsonField(
  423. rechtItemItem,
  424. r'''$.parent_titel''',
  425. ).toString()}',
  426. style: FlutterFlowTheme.of(context)
  427. .bodyMedium
  428. .override(
  429. font: GoogleFonts.roboto(
  430. fontWeight:
  431. FlutterFlowTheme.of(context)
  432. .bodyMedium
  433. .fontWeight,
  434. fontStyle:
  435. FlutterFlowTheme.of(context)
  436. .bodyMedium
  437. .fontStyle,
  438. ),
  439. letterSpacing: 0.0,
  440. fontWeight: FlutterFlowTheme.of(context)
  441. .bodyMedium
  442. .fontWeight,
  443. fontStyle: FlutterFlowTheme.of(context)
  444. .bodyMedium
  445. .fontStyle,
  446. ),
  447. ),
  448. ],
  449. );
  450. },
  451. );
  452. },
  453. );
  454. },
  455. ),
  456. ],
  457. ),
  458. ),
  459. ),
  460. ),
  461. );
  462. }
  463. }