horecagelegenheidoverzicht_kaart_widget.dart 15 KB

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