evenement_component_widget.dart 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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 Builder(
  154. builder: (context) {
  155. if (fotoosItem != '') {
  156. return ClipRRect(
  157. borderRadius: BorderRadius.circular(8.0),
  158. child: CachedNetworkImage(
  159. fadeInDuration: Duration(milliseconds: 500),
  160. fadeOutDuration: Duration(milliseconds: 500),
  161. imageUrl: fotoosItem,
  162. width: 200.0,
  163. height: 200.0,
  164. fit: BoxFit.cover,
  165. ),
  166. );
  167. } else {
  168. return Icon(
  169. Icons.image_not_supported,
  170. color: FlutterFlowTheme.of(context).primaryText,
  171. size: 24.0,
  172. );
  173. }
  174. },
  175. );
  176. },
  177. carouselController: _model.carouselController ??=
  178. CarouselSliderController(),
  179. options: CarouselOptions(
  180. initialPage: max(0, min(1, fotoos.length - 1)),
  181. viewportFraction: 0.5,
  182. disableCenter: true,
  183. enlargeCenterPage: true,
  184. enlargeFactor: 0.25,
  185. enableInfiniteScroll: true,
  186. scrollDirection: Axis.horizontal,
  187. autoPlay: false,
  188. onPageChanged: (index, _) =>
  189. _model.carouselCurrentIndex = index,
  190. ),
  191. ),
  192. );
  193. },
  194. ),
  195. ),
  196. Text(
  197. valueOrDefault<String>(
  198. getJsonField(
  199. columnEvenementResponse.jsonBody,
  200. r'''$[0].title''',
  201. )?.toString(),
  202. 'title',
  203. ),
  204. style: FlutterFlowTheme.of(context).headlineLarge.override(
  205. font: GoogleFonts.interTight(
  206. fontWeight:
  207. FlutterFlowTheme.of(context).headlineLarge.fontWeight,
  208. fontStyle:
  209. FlutterFlowTheme.of(context).headlineLarge.fontStyle,
  210. ),
  211. letterSpacing: 0.0,
  212. fontWeight:
  213. FlutterFlowTheme.of(context).headlineLarge.fontWeight,
  214. fontStyle:
  215. FlutterFlowTheme.of(context).headlineLarge.fontStyle,
  216. ),
  217. ),
  218. Text(
  219. valueOrDefault<String>(
  220. EvenementCall.eventDate(
  221. columnEvenementResponse.jsonBody,
  222. ),
  223. 'eventDate',
  224. ),
  225. style: FlutterFlowTheme.of(context).bodyMedium.override(
  226. font: GoogleFonts.inter(
  227. fontWeight:
  228. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  229. fontStyle:
  230. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  231. ),
  232. letterSpacing: 0.0,
  233. fontWeight:
  234. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  235. fontStyle:
  236. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  237. ),
  238. ),
  239. Builder(
  240. builder: (context) {
  241. final categories = EvenementCall.eventCategorie(
  242. columnEvenementResponse.jsonBody,
  243. )?.toList() ??
  244. [];
  245. _model.debugGeneratorVariables[
  246. 'categories${categories.length > 100 ? ' (first 100)' : ''}'] =
  247. debugSerializeParam(
  248. categories.take(100),
  249. ParamType.String,
  250. isList: true,
  251. link:
  252. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=EvenementComponent',
  253. name: 'String',
  254. nullable: false,
  255. );
  256. debugLogWidgetClass(_model);
  257. return Row(
  258. mainAxisSize: MainAxisSize.max,
  259. children: List.generate(categories.length, (categoriesIndex) {
  260. final categoriesItem = categories[categoriesIndex];
  261. return Padding(
  262. padding:
  263. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 8.0, 0.0),
  264. child: Text(
  265. categoriesItem,
  266. style: FlutterFlowTheme.of(context).bodyMedium.override(
  267. font: GoogleFonts.inter(
  268. fontWeight: FlutterFlowTheme.of(context)
  269. .bodyMedium
  270. .fontWeight,
  271. fontStyle: FlutterFlowTheme.of(context)
  272. .bodyMedium
  273. .fontStyle,
  274. ),
  275. letterSpacing: 0.0,
  276. fontWeight: FlutterFlowTheme.of(context)
  277. .bodyMedium
  278. .fontWeight,
  279. fontStyle: FlutterFlowTheme.of(context)
  280. .bodyMedium
  281. .fontStyle,
  282. ),
  283. ),
  284. );
  285. }),
  286. );
  287. },
  288. ),
  289. Column(
  290. mainAxisSize: MainAxisSize.max,
  291. children: [
  292. Text(
  293. valueOrDefault<String>(
  294. EvenementCall.eventAdres(
  295. columnEvenementResponse.jsonBody,
  296. ),
  297. 'adres',
  298. ),
  299. style: FlutterFlowTheme.of(context).bodyMedium.override(
  300. font: GoogleFonts.inter(
  301. fontWeight: FlutterFlowTheme.of(context)
  302. .bodyMedium
  303. .fontWeight,
  304. fontStyle:
  305. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  306. ),
  307. letterSpacing: 0.0,
  308. fontWeight:
  309. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  310. fontStyle:
  311. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  312. ),
  313. ),
  314. Text(
  315. valueOrDefault<String>(
  316. EvenementCall.eventPlaats(
  317. columnEvenementResponse.jsonBody,
  318. ),
  319. 'plaats',
  320. ),
  321. style: FlutterFlowTheme.of(context).bodyMedium.override(
  322. font: GoogleFonts.inter(
  323. fontWeight: FlutterFlowTheme.of(context)
  324. .bodyMedium
  325. .fontWeight,
  326. fontStyle:
  327. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  328. ),
  329. letterSpacing: 0.0,
  330. fontWeight:
  331. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  332. fontStyle:
  333. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  334. ),
  335. ),
  336. Row(
  337. mainAxisSize: MainAxisSize.max,
  338. children: [
  339. Text(
  340. FFLocalizations.of(context).getText(
  341. 'nghx1743' /* entreetoelichting */,
  342. ),
  343. style: FlutterFlowTheme.of(context).bodyMedium.override(
  344. font: GoogleFonts.inter(
  345. fontWeight: FlutterFlowTheme.of(context)
  346. .bodyMedium
  347. .fontWeight,
  348. fontStyle: FlutterFlowTheme.of(context)
  349. .bodyMedium
  350. .fontStyle,
  351. ),
  352. letterSpacing: 0.0,
  353. fontWeight: FlutterFlowTheme.of(context)
  354. .bodyMedium
  355. .fontWeight,
  356. fontStyle: FlutterFlowTheme.of(context)
  357. .bodyMedium
  358. .fontStyle,
  359. ),
  360. ),
  361. Text(
  362. FFLocalizations.of(context).getText(
  363. 'y02m0qh0' /* 15 euro */,
  364. ),
  365. style: FlutterFlowTheme.of(context).bodyMedium.override(
  366. font: GoogleFonts.inter(
  367. fontWeight: FlutterFlowTheme.of(context)
  368. .bodyMedium
  369. .fontWeight,
  370. fontStyle: FlutterFlowTheme.of(context)
  371. .bodyMedium
  372. .fontStyle,
  373. ),
  374. letterSpacing: 0.0,
  375. fontWeight: FlutterFlowTheme.of(context)
  376. .bodyMedium
  377. .fontWeight,
  378. fontStyle: FlutterFlowTheme.of(context)
  379. .bodyMedium
  380. .fontStyle,
  381. ),
  382. ),
  383. InkWell(
  384. splashColor: Colors.transparent,
  385. focusColor: Colors.transparent,
  386. hoverColor: Colors.transparent,
  387. highlightColor: Colors.transparent,
  388. onTap: () async {
  389. await launchURL(EvenementCall.eventWebsiteg(
  390. columnEvenementResponse.jsonBody,
  391. )!);
  392. },
  393. child: Text(
  394. FFLocalizations.of(context).getText(
  395. 'izrkv2a9' /* Website */,
  396. ),
  397. style: FlutterFlowTheme.of(context).bodyMedium.override(
  398. font: GoogleFonts.inter(
  399. fontWeight: FlutterFlowTheme.of(context)
  400. .bodyMedium
  401. .fontWeight,
  402. fontStyle: FlutterFlowTheme.of(context)
  403. .bodyMedium
  404. .fontStyle,
  405. ),
  406. letterSpacing: 0.0,
  407. fontWeight: FlutterFlowTheme.of(context)
  408. .bodyMedium
  409. .fontWeight,
  410. fontStyle: FlutterFlowTheme.of(context)
  411. .bodyMedium
  412. .fontStyle,
  413. ),
  414. ),
  415. ),
  416. Text(
  417. FFLocalizations.of(context).getText(
  418. 'lrjms1by' /* Hello World Contactveld */,
  419. ),
  420. style: FlutterFlowTheme.of(context).bodyMedium.override(
  421. font: GoogleFonts.inter(
  422. fontWeight: FlutterFlowTheme.of(context)
  423. .bodyMedium
  424. .fontWeight,
  425. fontStyle: FlutterFlowTheme.of(context)
  426. .bodyMedium
  427. .fontStyle,
  428. ),
  429. letterSpacing: 0.0,
  430. fontWeight: FlutterFlowTheme.of(context)
  431. .bodyMedium
  432. .fontWeight,
  433. fontStyle: FlutterFlowTheme.of(context)
  434. .bodyMedium
  435. .fontStyle,
  436. ),
  437. ),
  438. ],
  439. ),
  440. Wrap(
  441. spacing: 0.0,
  442. runSpacing: 0.0,
  443. alignment: WrapAlignment.start,
  444. crossAxisAlignment: WrapCrossAlignment.start,
  445. direction: Axis.horizontal,
  446. runAlignment: WrapAlignment.start,
  447. verticalDirection: VerticalDirection.down,
  448. clipBehavior: Clip.none,
  449. children: [
  450. Builder(
  451. builder: (context) {
  452. if (getJsonField(
  453. columnEvenementResponse.jsonBody,
  454. r'''$[0].logo''',
  455. ) !=
  456. null) {
  457. return ClipRRect(
  458. borderRadius: BorderRadius.circular(8.0),
  459. child: CachedNetworkImage(
  460. fadeInDuration: Duration(milliseconds: 500),
  461. fadeOutDuration: Duration(milliseconds: 500),
  462. imageUrl: EvenementCall.eventLogog(
  463. columnEvenementResponse.jsonBody,
  464. )!,
  465. width: 40.0,
  466. height: 40.0,
  467. fit: BoxFit.cover,
  468. ),
  469. );
  470. } else {
  471. return Icon(
  472. Icons.image_not_supported,
  473. color: FlutterFlowTheme.of(context).primaryText,
  474. size: 24.0,
  475. );
  476. }
  477. },
  478. ),
  479. Container(
  480. width: MediaQuery.sizeOf(context).width * 0.4,
  481. height: MediaQuery.sizeOf(context).height * 0.4,
  482. child: custom_widgets.FromHTML(
  483. width: MediaQuery.sizeOf(context).width * 0.4,
  484. height: MediaQuery.sizeOf(context).height * 0.4,
  485. HTMLParameter: EvenementCall.eventBody(
  486. columnEvenementResponse.jsonBody,
  487. )!,
  488. ),
  489. ),
  490. ],
  491. ),
  492. ],
  493. ),
  494. Expanded(
  495. child: wrapWithModel(
  496. model: _model.evenementHorecagelegenheidModel,
  497. updateCallback: () => safeSetState(() {}),
  498. child: Builder(builder: (_) {
  499. return DebugFlutterFlowModelContext(
  500. rootModel: _model.rootModel,
  501. child: EvenementHorecagelegenheidWidget(
  502. establishmentID: widget!.nid!,
  503. ),
  504. );
  505. }),
  506. ),
  507. ),
  508. ],
  509. );
  510. },
  511. );
  512. }
  513. }