evenement_component_widget.dart 19 KB

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