horecagelegenheidoverzicht_kaart_widget.dart 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. import '/flutter_flow/flutter_flow_theme.dart';
  2. import '/flutter_flow/flutter_flow_util.dart';
  3. import '/flutter_flow/flutter_flow_widgets.dart';
  4. import 'dart:ui';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter_spinkit/flutter_spinkit.dart';
  7. import 'package:google_fonts/google_fonts.dart';
  8. import 'package:provider/provider.dart';
  9. import 'horecagelegenheidoverzicht_kaart_model.dart';
  10. export 'horecagelegenheidoverzicht_kaart_model.dart';
  11. /// Create a component with a card overview of cards with the following data;
  12. /// {
  13. /// "nid": "75618",
  14. /// "titel": "Hof van Cartesius",
  15. /// "adres": "Vlampijpstraat 84-94\n",
  16. /// "plaats": "Utrecht (stad)",
  17. /// "logo":
  18. /// "https://uitgaanskrant.com/sites/uitgaanskrant.com/files/car.jpg",
  19. /// "categorie": [
  20. /// "Ondernemen",
  21. /// "Zaalverhuur"
  22. /// ]
  23. /// },
  24. /// i retrieve it with an api call named; Establishments
  25. ///
  26. /// The cards have a logo on the left and the details on the rigth of the
  27. /// card.
  28. ///
  29. /// Only show max 3 categorie items. Put points behind the last to expand all
  30. /// the categories.
  31. /// The categories are shown as buttons (containers) on the logo picture.
  32. class HorecagelegenheidoverzichtKaartWidget extends StatefulWidget {
  33. const HorecagelegenheidoverzichtKaartWidget({
  34. super.key,
  35. this.titel,
  36. this.logo,
  37. this.nid,
  38. this.adres,
  39. this.plaats,
  40. this.categorie,
  41. });
  42. final String? titel;
  43. final String? logo;
  44. final String? nid;
  45. final String? adres;
  46. final String? plaats;
  47. final List<String>? categorie;
  48. @override
  49. State<HorecagelegenheidoverzichtKaartWidget> createState() =>
  50. _HorecagelegenheidoverzichtKaartWidgetState();
  51. }
  52. class _HorecagelegenheidoverzichtKaartWidgetState
  53. extends State<HorecagelegenheidoverzichtKaartWidget> with RouteAware {
  54. late HorecagelegenheidoverzichtKaartModel _model;
  55. @override
  56. void setState(VoidCallback callback) {
  57. super.setState(callback);
  58. _model.onUpdate();
  59. }
  60. @override
  61. void initState() {
  62. super.initState();
  63. _model = createModel(context, () => HorecagelegenheidoverzichtKaartModel());
  64. }
  65. @override
  66. void dispose() {
  67. routeObserver.unsubscribe(this);
  68. _model.maybeDispose();
  69. super.dispose();
  70. }
  71. @override
  72. void didUpdateWidget(HorecagelegenheidoverzichtKaartWidget oldWidget) {
  73. super.didUpdateWidget(oldWidget);
  74. _model.widget = widget;
  75. }
  76. @override
  77. void didChangeDependencies() {
  78. super.didChangeDependencies();
  79. final route = DebugModalRoute.of(context);
  80. if (route != null) {
  81. routeObserver.subscribe(this, route);
  82. }
  83. debugLogGlobalProperty(context);
  84. }
  85. @override
  86. void didPopNext() {
  87. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  88. setState(() => _model.isRouteVisible = true);
  89. debugLogWidgetClass(_model);
  90. }
  91. }
  92. @override
  93. void didPush() {
  94. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  95. setState(() => _model.isRouteVisible = true);
  96. debugLogWidgetClass(_model);
  97. }
  98. }
  99. @override
  100. void didPop() {
  101. _model.isRouteVisible = false;
  102. }
  103. @override
  104. void didPushNext() {
  105. _model.isRouteVisible = false;
  106. }
  107. @override
  108. Widget build(BuildContext context) {
  109. DebugFlutterFlowModelContext.maybeOf(context)
  110. ?.parentModelCallback
  111. ?.call(_model);
  112. return Padding(
  113. padding: EdgeInsetsDirectional.fromSTEB(16.0, 16.0, 16.0, 16.0),
  114. child: Container(
  115. decoration: BoxDecoration(
  116. color: FlutterFlowTheme.of(context).secondaryBackground,
  117. boxShadow: [
  118. BoxShadow(
  119. blurRadius: 4.0,
  120. color: Color(0x33000000),
  121. offset: Offset(
  122. 0.0,
  123. 2.0,
  124. ),
  125. spreadRadius: 0.0,
  126. )
  127. ],
  128. borderRadius: BorderRadius.circular(12.0),
  129. ),
  130. child: Padding(
  131. padding: EdgeInsets.all(12.0),
  132. child: Row(
  133. mainAxisSize: MainAxisSize.max,
  134. children: [
  135. Flexible(
  136. child: Align(
  137. alignment: AlignmentDirectional(-1.0, 1.0),
  138. child: Stack(
  139. alignment: AlignmentDirectional(-1.0, 1.0),
  140. children: [
  141. ClipRRect(
  142. borderRadius: BorderRadius.circular(8.0),
  143. child: Image.network(
  144. widget!.logo!,
  145. fit: BoxFit.cover,
  146. ),
  147. ),
  148. Align(
  149. alignment: AlignmentDirectional(-1.0, 1.0),
  150. child: Padding(
  151. padding: EdgeInsetsDirectional.fromSTEB(
  152. 8.0, 0.0, 8.0, 0.0),
  153. child: Builder(
  154. builder: (context) {
  155. final categorie =
  156. (widget!.categorie?.toList() ?? [])
  157. .take(3)
  158. .toList();
  159. _model.debugGeneratorVariables[
  160. 'categorie${categorie.length > 100 ? ' (first 100)' : ''}'] =
  161. debugSerializeParam(
  162. categorie.take(100),
  163. ParamType.String,
  164. isList: true,
  165. link:
  166. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=HorecagelegenheidoverzichtKaart',
  167. name: 'String',
  168. nullable: false,
  169. );
  170. debugLogWidgetClass(_model);
  171. return Column(
  172. mainAxisSize: MainAxisSize.min,
  173. mainAxisAlignment: MainAxisAlignment.end,
  174. crossAxisAlignment: CrossAxisAlignment.start,
  175. children: List.generate(categorie.length,
  176. (categorieIndex) {
  177. final categorieItem =
  178. categorie[categorieIndex];
  179. return Align(
  180. alignment: AlignmentDirectional(-1.0, 1.0),
  181. child: Container(
  182. decoration: BoxDecoration(),
  183. alignment:
  184. AlignmentDirectional(-1.0, 1.0),
  185. child: Padding(
  186. padding: EdgeInsetsDirectional.fromSTEB(
  187. 6.0, 0.0, 6.0, 0.0),
  188. child: Container(
  189. decoration: BoxDecoration(
  190. color: Color(0xCC4B39EF),
  191. borderRadius:
  192. BorderRadius.circular(12.0),
  193. ),
  194. child: Padding(
  195. padding: EdgeInsets.all(8.0),
  196. child: Text(
  197. categorieItem,
  198. style:
  199. FlutterFlowTheme.of(context)
  200. .labelSmall
  201. .override(
  202. font: GoogleFonts.inter(
  203. fontWeight:
  204. FlutterFlowTheme.of(
  205. context)
  206. .labelSmall
  207. .fontWeight,
  208. fontStyle:
  209. FlutterFlowTheme.of(
  210. context)
  211. .labelSmall
  212. .fontStyle,
  213. ),
  214. color: Colors.white,
  215. fontSize: 10.0,
  216. letterSpacing: 0.0,
  217. fontWeight:
  218. FlutterFlowTheme.of(
  219. context)
  220. .labelSmall
  221. .fontWeight,
  222. fontStyle:
  223. FlutterFlowTheme.of(
  224. context)
  225. .labelSmall
  226. .fontStyle,
  227. ),
  228. ),
  229. ),
  230. ),
  231. ),
  232. ),
  233. );
  234. }).divide(SizedBox(height: 4.0)),
  235. );
  236. },
  237. ),
  238. ),
  239. ),
  240. ],
  241. ),
  242. ),
  243. ),
  244. Expanded(
  245. child: Container(
  246. width: () {
  247. if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
  248. return 200.0;
  249. } else if (MediaQuery.sizeOf(context).width <
  250. kBreakpointMedium) {
  251. return 250.0;
  252. } else if (MediaQuery.sizeOf(context).width <
  253. kBreakpointLarge) {
  254. return 300.0;
  255. } else {
  256. return 350.0;
  257. }
  258. }(),
  259. decoration: BoxDecoration(),
  260. child: Column(
  261. mainAxisSize: MainAxisSize.min,
  262. mainAxisAlignment: MainAxisAlignment.start,
  263. crossAxisAlignment: CrossAxisAlignment.start,
  264. children: [
  265. Text(
  266. valueOrDefault<String>(
  267. widget!.titel,
  268. 'titel',
  269. ),
  270. style:
  271. FlutterFlowTheme.of(context).titleMedium.override(
  272. font: GoogleFonts.interTight(
  273. fontWeight: FontWeight.w600,
  274. fontStyle: FlutterFlowTheme.of(context)
  275. .titleMedium
  276. .fontStyle,
  277. ),
  278. letterSpacing: 0.0,
  279. fontWeight: FontWeight.w600,
  280. fontStyle: FlutterFlowTheme.of(context)
  281. .titleMedium
  282. .fontStyle,
  283. ),
  284. ),
  285. Column(
  286. mainAxisSize: MainAxisSize.min,
  287. crossAxisAlignment: CrossAxisAlignment.start,
  288. children: [
  289. Text(
  290. valueOrDefault<String>(
  291. widget!.adres,
  292. 'adres',
  293. ),
  294. style: FlutterFlowTheme.of(context)
  295. .bodyMedium
  296. .override(
  297. font: GoogleFonts.inter(
  298. fontWeight: FlutterFlowTheme.of(context)
  299. .bodyMedium
  300. .fontWeight,
  301. fontStyle: FlutterFlowTheme.of(context)
  302. .bodyMedium
  303. .fontStyle,
  304. ),
  305. color: FlutterFlowTheme.of(context)
  306. .secondaryText,
  307. letterSpacing: 0.0,
  308. fontWeight: FlutterFlowTheme.of(context)
  309. .bodyMedium
  310. .fontWeight,
  311. fontStyle: FlutterFlowTheme.of(context)
  312. .bodyMedium
  313. .fontStyle,
  314. ),
  315. ),
  316. Text(
  317. valueOrDefault<String>(
  318. widget!.plaats,
  319. 'plaats',
  320. ),
  321. style: FlutterFlowTheme.of(context)
  322. .bodyMedium
  323. .override(
  324. font: GoogleFonts.inter(
  325. fontWeight: FlutterFlowTheme.of(context)
  326. .bodyMedium
  327. .fontWeight,
  328. fontStyle: FlutterFlowTheme.of(context)
  329. .bodyMedium
  330. .fontStyle,
  331. ),
  332. color: FlutterFlowTheme.of(context)
  333. .secondaryText,
  334. letterSpacing: 0.0,
  335. fontWeight: FlutterFlowTheme.of(context)
  336. .bodyMedium
  337. .fontWeight,
  338. fontStyle: FlutterFlowTheme.of(context)
  339. .bodyMedium
  340. .fontStyle,
  341. ),
  342. ),
  343. ].divide(SizedBox(height: 4.0)),
  344. ),
  345. ].divide(SizedBox(height: 8.0)),
  346. ),
  347. ),
  348. ),
  349. ].divide(SizedBox(width: 16.0)),
  350. ),
  351. ),
  352. ),
  353. );
  354. }
  355. }