horecagelegenheidoverzicht_kaart_widget.dart 18 KB

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