evenement_component_widget.dart 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. import '/backend/api_requests/api_calls.dart';
  2. import '/evenement/evenement_horecagelegenheid/evenement_horecagelegenheid_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 'dart:ui';
  7. import '/custom_code/widgets/index.dart' as custom_widgets;
  8. import 'package:carousel_slider/carousel_slider.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:provider/provider.dart';
  14. import 'evenement_component_model.dart';
  15. export 'evenement_component_model.dart';
  16. class EvenementComponentWidget extends StatefulWidget {
  17. const EvenementComponentWidget({
  18. super.key,
  19. this.nid,
  20. });
  21. final String? nid;
  22. @override
  23. State<EvenementComponentWidget> createState() =>
  24. _EvenementComponentWidgetState();
  25. }
  26. class _EvenementComponentWidgetState extends State<EvenementComponentWidget>
  27. with RouteAware {
  28. late EvenementComponentModel _model;
  29. @override
  30. void setState(VoidCallback callback) {
  31. super.setState(callback);
  32. _model.onUpdate();
  33. }
  34. @override
  35. void initState() {
  36. super.initState();
  37. _model = createModel(context, () => EvenementComponentModel());
  38. }
  39. @override
  40. void dispose() {
  41. routeObserver.unsubscribe(this);
  42. _model.maybeDispose();
  43. super.dispose();
  44. }
  45. @override
  46. void didUpdateWidget(EvenementComponentWidget oldWidget) {
  47. super.didUpdateWidget(oldWidget);
  48. _model.widget = widget;
  49. }
  50. @override
  51. void didChangeDependencies() {
  52. super.didChangeDependencies();
  53. final route = DebugModalRoute.of(context);
  54. if (route != null) {
  55. routeObserver.subscribe(this, route);
  56. }
  57. debugLogGlobalProperty(context);
  58. }
  59. @override
  60. void didPopNext() {
  61. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  62. setState(() => _model.isRouteVisible = true);
  63. debugLogWidgetClass(_model);
  64. }
  65. }
  66. @override
  67. void didPush() {
  68. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  69. setState(() => _model.isRouteVisible = true);
  70. debugLogWidgetClass(_model);
  71. }
  72. }
  73. @override
  74. void didPop() {
  75. _model.isRouteVisible = false;
  76. }
  77. @override
  78. void didPushNext() {
  79. _model.isRouteVisible = false;
  80. }
  81. @override
  82. Widget build(BuildContext context) {
  83. DebugFlutterFlowModelContext.maybeOf(context)
  84. ?.parentModelCallback
  85. ?.call(_model);
  86. return FutureBuilder<ApiCallResponse>(
  87. future: EvenementCall.call(
  88. nid: widget!.nid,
  89. ),
  90. builder: (context, snapshot) {
  91. // Customize what your widget looks like when it's loading.
  92. if (!snapshot.hasData) {
  93. return Center(
  94. child: SizedBox(
  95. width: 80.0,
  96. height: 80.0,
  97. child: SpinKitFadingCircle(
  98. color: Color(0xFFB1061E),
  99. size: 80.0,
  100. ),
  101. ),
  102. );
  103. }
  104. final columnEvenementResponse = snapshot.data!;
  105. _model.debugBackendQueries['EvenementCall_statusCode_Column_7p7qgpjv'] =
  106. debugSerializeParam(
  107. columnEvenementResponse.statusCode,
  108. ParamType.int,
  109. link:
  110. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=EvenementComponent',
  111. name: 'int',
  112. nullable: false,
  113. );
  114. _model.debugBackendQueries[
  115. 'EvenementCall_responseBody_Column_7p7qgpjv'] = debugSerializeParam(
  116. columnEvenementResponse.bodyText,
  117. ParamType.String,
  118. link:
  119. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=EvenementComponent',
  120. name: 'String',
  121. nullable: false,
  122. );
  123. debugLogWidgetClass(_model);
  124. return Column(
  125. mainAxisSize: MainAxisSize.min,
  126. children: [
  127. Expanded(
  128. child: Builder(
  129. builder: (context) {
  130. final fotoos = EvenementCall.eventFotoos(
  131. columnEvenementResponse.jsonBody,
  132. )?.toList() ??
  133. [];
  134. _model.debugGeneratorVariables[
  135. 'fotoos${fotoos.length > 100 ? ' (first 100)' : ''}'] =
  136. debugSerializeParam(
  137. fotoos.take(100),
  138. ParamType.String,
  139. isList: true,
  140. link:
  141. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=EvenementComponent',
  142. name: 'String',
  143. nullable: false,
  144. );
  145. debugLogWidgetClass(_model);
  146. return Container(
  147. width: double.infinity,
  148. height: 200.0,
  149. child: CarouselSlider.builder(
  150. itemCount: fotoos.length,
  151. itemBuilder: (context, fotoosIndex, _) {
  152. final fotoosItem = fotoos[fotoosIndex];
  153. return ClipRRect(
  154. borderRadius: BorderRadius.circular(8.0),
  155. child: CachedNetworkImage(
  156. fadeInDuration: Duration(milliseconds: 500),
  157. fadeOutDuration: Duration(milliseconds: 500),
  158. imageUrl: fotoosItem,
  159. width: 200.0,
  160. height: 200.0,
  161. fit: BoxFit.cover,
  162. ),
  163. );
  164. },
  165. carouselController: _model.carouselController ??=
  166. CarouselSliderController(),
  167. options: CarouselOptions(
  168. initialPage: max(0, min(1, fotoos.length - 1)),
  169. viewportFraction: 0.5,
  170. disableCenter: true,
  171. enlargeCenterPage: true,
  172. enlargeFactor: 0.25,
  173. enableInfiniteScroll: true,
  174. scrollDirection: Axis.horizontal,
  175. autoPlay: false,
  176. onPageChanged: (index, _) =>
  177. _model.carouselCurrentIndex = index,
  178. ),
  179. ),
  180. );
  181. },
  182. ),
  183. ),
  184. Text(
  185. valueOrDefault<String>(
  186. getJsonField(
  187. columnEvenementResponse.jsonBody,
  188. r'''$[0].title''',
  189. )?.toString(),
  190. 'title',
  191. ),
  192. style: FlutterFlowTheme.of(context).headlineLarge.override(
  193. font: GoogleFonts.interTight(
  194. fontWeight:
  195. FlutterFlowTheme.of(context).headlineLarge.fontWeight,
  196. fontStyle:
  197. FlutterFlowTheme.of(context).headlineLarge.fontStyle,
  198. ),
  199. letterSpacing: 0.0,
  200. fontWeight:
  201. FlutterFlowTheme.of(context).headlineLarge.fontWeight,
  202. fontStyle:
  203. FlutterFlowTheme.of(context).headlineLarge.fontStyle,
  204. ),
  205. ),
  206. Text(
  207. valueOrDefault<String>(
  208. EvenementCall.eventDate(
  209. columnEvenementResponse.jsonBody,
  210. ),
  211. 'eventDate',
  212. ),
  213. style: FlutterFlowTheme.of(context).bodyMedium.override(
  214. font: GoogleFonts.inter(
  215. fontWeight:
  216. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  217. fontStyle:
  218. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  219. ),
  220. letterSpacing: 0.0,
  221. fontWeight:
  222. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  223. fontStyle:
  224. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  225. ),
  226. ),
  227. Builder(
  228. builder: (context) {
  229. final categories = EvenementCall.eventCategorie(
  230. columnEvenementResponse.jsonBody,
  231. )?.toList() ??
  232. [];
  233. _model.debugGeneratorVariables[
  234. 'categories${categories.length > 100 ? ' (first 100)' : ''}'] =
  235. debugSerializeParam(
  236. categories.take(100),
  237. ParamType.String,
  238. isList: true,
  239. link:
  240. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=EvenementComponent',
  241. name: 'String',
  242. nullable: false,
  243. );
  244. debugLogWidgetClass(_model);
  245. return Row(
  246. mainAxisSize: MainAxisSize.max,
  247. children: List.generate(categories.length, (categoriesIndex) {
  248. final categoriesItem = categories[categoriesIndex];
  249. return Padding(
  250. padding:
  251. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 8.0, 0.0),
  252. child: Text(
  253. categoriesItem,
  254. style: FlutterFlowTheme.of(context).bodyMedium.override(
  255. font: GoogleFonts.inter(
  256. fontWeight: FlutterFlowTheme.of(context)
  257. .bodyMedium
  258. .fontWeight,
  259. fontStyle: FlutterFlowTheme.of(context)
  260. .bodyMedium
  261. .fontStyle,
  262. ),
  263. letterSpacing: 0.0,
  264. fontWeight: FlutterFlowTheme.of(context)
  265. .bodyMedium
  266. .fontWeight,
  267. fontStyle: FlutterFlowTheme.of(context)
  268. .bodyMedium
  269. .fontStyle,
  270. ),
  271. ),
  272. );
  273. }),
  274. );
  275. },
  276. ),
  277. Column(
  278. mainAxisSize: MainAxisSize.max,
  279. children: [
  280. Text(
  281. valueOrDefault<String>(
  282. EvenementCall.eventAdres(
  283. columnEvenementResponse.jsonBody,
  284. ),
  285. 'adres',
  286. ),
  287. style: FlutterFlowTheme.of(context).bodyMedium.override(
  288. font: GoogleFonts.inter(
  289. fontWeight: FlutterFlowTheme.of(context)
  290. .bodyMedium
  291. .fontWeight,
  292. fontStyle:
  293. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  294. ),
  295. letterSpacing: 0.0,
  296. fontWeight:
  297. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  298. fontStyle:
  299. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  300. ),
  301. ),
  302. Text(
  303. valueOrDefault<String>(
  304. EvenementCall.eventPlaats(
  305. columnEvenementResponse.jsonBody,
  306. ),
  307. 'plaats',
  308. ),
  309. style: FlutterFlowTheme.of(context).bodyMedium.override(
  310. font: GoogleFonts.inter(
  311. fontWeight: FlutterFlowTheme.of(context)
  312. .bodyMedium
  313. .fontWeight,
  314. fontStyle:
  315. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  316. ),
  317. letterSpacing: 0.0,
  318. fontWeight:
  319. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  320. fontStyle:
  321. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  322. ),
  323. ),
  324. Row(
  325. mainAxisSize: MainAxisSize.max,
  326. children: [
  327. Text(
  328. FFLocalizations.of(context).getText(
  329. 'nghx1743' /* entreetoelichting */,
  330. ),
  331. style: FlutterFlowTheme.of(context).bodyMedium.override(
  332. font: GoogleFonts.inter(
  333. fontWeight: FlutterFlowTheme.of(context)
  334. .bodyMedium
  335. .fontWeight,
  336. fontStyle: FlutterFlowTheme.of(context)
  337. .bodyMedium
  338. .fontStyle,
  339. ),
  340. letterSpacing: 0.0,
  341. fontWeight: FlutterFlowTheme.of(context)
  342. .bodyMedium
  343. .fontWeight,
  344. fontStyle: FlutterFlowTheme.of(context)
  345. .bodyMedium
  346. .fontStyle,
  347. ),
  348. ),
  349. Text(
  350. FFLocalizations.of(context).getText(
  351. 'y02m0qh0' /* 15 euro */,
  352. ),
  353. style: FlutterFlowTheme.of(context).bodyMedium.override(
  354. font: GoogleFonts.inter(
  355. fontWeight: FlutterFlowTheme.of(context)
  356. .bodyMedium
  357. .fontWeight,
  358. fontStyle: FlutterFlowTheme.of(context)
  359. .bodyMedium
  360. .fontStyle,
  361. ),
  362. letterSpacing: 0.0,
  363. fontWeight: FlutterFlowTheme.of(context)
  364. .bodyMedium
  365. .fontWeight,
  366. fontStyle: FlutterFlowTheme.of(context)
  367. .bodyMedium
  368. .fontStyle,
  369. ),
  370. ),
  371. InkWell(
  372. splashColor: Colors.transparent,
  373. focusColor: Colors.transparent,
  374. hoverColor: Colors.transparent,
  375. highlightColor: Colors.transparent,
  376. onTap: () async {
  377. await launchURL(EvenementCall.eventWebsiteg(
  378. columnEvenementResponse.jsonBody,
  379. )!);
  380. },
  381. child: Text(
  382. FFLocalizations.of(context).getText(
  383. 'izrkv2a9' /* Website */,
  384. ),
  385. style: FlutterFlowTheme.of(context).bodyMedium.override(
  386. font: GoogleFonts.inter(
  387. fontWeight: FlutterFlowTheme.of(context)
  388. .bodyMedium
  389. .fontWeight,
  390. fontStyle: FlutterFlowTheme.of(context)
  391. .bodyMedium
  392. .fontStyle,
  393. ),
  394. letterSpacing: 0.0,
  395. fontWeight: FlutterFlowTheme.of(context)
  396. .bodyMedium
  397. .fontWeight,
  398. fontStyle: FlutterFlowTheme.of(context)
  399. .bodyMedium
  400. .fontStyle,
  401. ),
  402. ),
  403. ),
  404. Text(
  405. FFLocalizations.of(context).getText(
  406. 'lrjms1by' /* Hello World Contactveld */,
  407. ),
  408. style: FlutterFlowTheme.of(context).bodyMedium.override(
  409. font: GoogleFonts.inter(
  410. fontWeight: FlutterFlowTheme.of(context)
  411. .bodyMedium
  412. .fontWeight,
  413. fontStyle: FlutterFlowTheme.of(context)
  414. .bodyMedium
  415. .fontStyle,
  416. ),
  417. letterSpacing: 0.0,
  418. fontWeight: FlutterFlowTheme.of(context)
  419. .bodyMedium
  420. .fontWeight,
  421. fontStyle: FlutterFlowTheme.of(context)
  422. .bodyMedium
  423. .fontStyle,
  424. ),
  425. ),
  426. ],
  427. ),
  428. Wrap(
  429. spacing: 0.0,
  430. runSpacing: 0.0,
  431. alignment: WrapAlignment.start,
  432. crossAxisAlignment: WrapCrossAlignment.start,
  433. direction: Axis.horizontal,
  434. runAlignment: WrapAlignment.start,
  435. verticalDirection: VerticalDirection.down,
  436. clipBehavior: Clip.none,
  437. children: [
  438. ClipRRect(
  439. borderRadius: BorderRadius.circular(8.0),
  440. child: CachedNetworkImage(
  441. fadeInDuration: Duration(milliseconds: 500),
  442. fadeOutDuration: Duration(milliseconds: 500),
  443. imageUrl: EvenementCall.eventLogog(
  444. columnEvenementResponse.jsonBody,
  445. )!,
  446. width: 40.0,
  447. height: 40.0,
  448. fit: BoxFit.cover,
  449. ),
  450. ),
  451. Container(
  452. width: MediaQuery.sizeOf(context).width * 0.4,
  453. height: MediaQuery.sizeOf(context).height * 0.4,
  454. child: custom_widgets.FromHTML(
  455. width: MediaQuery.sizeOf(context).width * 0.4,
  456. height: MediaQuery.sizeOf(context).height * 0.4,
  457. HTMLParameter: EvenementCall.eventBody(
  458. columnEvenementResponse.jsonBody,
  459. )!,
  460. ),
  461. ),
  462. ],
  463. ),
  464. ],
  465. ),
  466. Expanded(
  467. child: wrapWithModel(
  468. model: _model.evenementHorecagelegenheidModel,
  469. updateCallback: () => safeSetState(() {}),
  470. child: Builder(builder: (_) {
  471. return DebugFlutterFlowModelContext(
  472. rootModel: _model.rootModel,
  473. child: EvenementHorecagelegenheidWidget(
  474. establishmentID: widget!.nid!,
  475. ),
  476. );
  477. }),
  478. ),
  479. ),
  480. ],
  481. );
  482. },
  483. );
  484. }
  485. }