horecagelegenheidoverzicht_kaart_widget.dart 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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. Builder(
  145. builder: (context) {
  146. if (widget!.logo != '') {
  147. return ClipRRect(
  148. borderRadius: BorderRadius.circular(8.0),
  149. child: CachedNetworkImage(
  150. fadeInDuration: Duration(milliseconds: 0),
  151. fadeOutDuration: Duration(milliseconds: 0),
  152. imageUrl: widget!.logo!,
  153. fit: BoxFit.cover,
  154. ),
  155. );
  156. } else {
  157. return Icon(
  158. Icons.image_not_supported,
  159. color: FlutterFlowTheme.of(context).primaryText,
  160. size: 24.0,
  161. );
  162. }
  163. },
  164. ),
  165. Align(
  166. alignment: AlignmentDirectional(-1.0, 1.0),
  167. child: Padding(
  168. padding: EdgeInsetsDirectional.fromSTEB(
  169. 8.0, 0.0, 8.0, 0.0),
  170. child: Builder(
  171. builder: (context) {
  172. final categorie =
  173. (widget!.categorie?.toList() ?? [])
  174. .take(3)
  175. .toList();
  176. _model.debugGeneratorVariables[
  177. 'categorie${categorie.length > 100 ? ' (first 100)' : ''}'] =
  178. debugSerializeParam(
  179. categorie.take(100),
  180. ParamType.String,
  181. isList: true,
  182. link:
  183. 'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=HorecagelegenheidoverzichtKaart',
  184. name: 'String',
  185. nullable: false,
  186. );
  187. debugLogWidgetClass(_model);
  188. return Column(
  189. mainAxisSize: MainAxisSize.min,
  190. mainAxisAlignment: MainAxisAlignment.end,
  191. crossAxisAlignment: CrossAxisAlignment.start,
  192. children: List.generate(categorie.length,
  193. (categorieIndex) {
  194. final categorieItem =
  195. categorie[categorieIndex];
  196. return Align(
  197. alignment: AlignmentDirectional(-1.0, 1.0),
  198. child: Container(
  199. decoration: BoxDecoration(),
  200. alignment:
  201. AlignmentDirectional(-1.0, 1.0),
  202. child: Padding(
  203. padding: EdgeInsetsDirectional.fromSTEB(
  204. 6.0, 0.0, 6.0, 0.0),
  205. child: Container(
  206. decoration: BoxDecoration(
  207. color: Color(0xCC4B39EF),
  208. borderRadius:
  209. BorderRadius.circular(12.0),
  210. ),
  211. child: Padding(
  212. padding: EdgeInsets.all(8.0),
  213. child: Text(
  214. categorieItem,
  215. style:
  216. FlutterFlowTheme.of(context)
  217. .labelSmall
  218. .override(
  219. font: GoogleFonts.inter(
  220. fontWeight:
  221. FlutterFlowTheme.of(
  222. context)
  223. .labelSmall
  224. .fontWeight,
  225. fontStyle:
  226. FlutterFlowTheme.of(
  227. context)
  228. .labelSmall
  229. .fontStyle,
  230. ),
  231. color: Colors.white,
  232. fontSize: 10.0,
  233. letterSpacing: 0.0,
  234. fontWeight:
  235. FlutterFlowTheme.of(
  236. context)
  237. .labelSmall
  238. .fontWeight,
  239. fontStyle:
  240. FlutterFlowTheme.of(
  241. context)
  242. .labelSmall
  243. .fontStyle,
  244. ),
  245. ),
  246. ),
  247. ),
  248. ),
  249. ),
  250. );
  251. }).divide(SizedBox(height: 4.0)),
  252. );
  253. },
  254. ),
  255. ),
  256. ),
  257. Align(
  258. alignment: AlignmentDirectional(1.0, -1.0),
  259. child: AlignedTooltip(
  260. content: Padding(
  261. padding: EdgeInsets.all(4.0),
  262. child: Text(
  263. FFLocalizations.of(context).getText(
  264. 'ujd0p09x' /* MessageFavoriet... */,
  265. ),
  266. style: FlutterFlowTheme.of(context)
  267. .bodyLarge
  268. .override(
  269. font: GoogleFonts.inter(
  270. fontWeight: FlutterFlowTheme.of(context)
  271. .bodyLarge
  272. .fontWeight,
  273. fontStyle: FlutterFlowTheme.of(context)
  274. .bodyLarge
  275. .fontStyle,
  276. ),
  277. letterSpacing: 0.0,
  278. fontWeight: FlutterFlowTheme.of(context)
  279. .bodyLarge
  280. .fontWeight,
  281. fontStyle: FlutterFlowTheme.of(context)
  282. .bodyLarge
  283. .fontStyle,
  284. ),
  285. ),
  286. ),
  287. offset: 4.0,
  288. preferredDirection: AxisDirection.down,
  289. borderRadius: BorderRadius.circular(8.0),
  290. backgroundColor:
  291. FlutterFlowTheme.of(context).secondaryBackground,
  292. elevation: 4.0,
  293. tailBaseWidth: 24.0,
  294. tailLength: 12.0,
  295. waitDuration: Duration(milliseconds: 100),
  296. showDuration: Duration(milliseconds: 1500),
  297. triggerMode: TooltipTriggerMode.tap,
  298. child: FlutterFlowIconButton(
  299. borderRadius: 8.0,
  300. buttonSize: 32.0,
  301. fillColor: Colors.white,
  302. icon: Icon(
  303. Icons.favorite_border,
  304. color: Color(0xFFB50808),
  305. size: 24.0,
  306. ),
  307. onPressed: () {
  308. print('IconButtonFavoriet pressed ...');
  309. },
  310. ),
  311. ),
  312. ),
  313. ],
  314. ),
  315. ),
  316. ),
  317. Expanded(
  318. child: Container(
  319. width: () {
  320. if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
  321. return 200.0;
  322. } else if (MediaQuery.sizeOf(context).width <
  323. kBreakpointMedium) {
  324. return 250.0;
  325. } else if (MediaQuery.sizeOf(context).width <
  326. kBreakpointLarge) {
  327. return 300.0;
  328. } else {
  329. return 350.0;
  330. }
  331. }(),
  332. decoration: BoxDecoration(),
  333. child: Column(
  334. mainAxisSize: MainAxisSize.min,
  335. mainAxisAlignment: MainAxisAlignment.start,
  336. crossAxisAlignment: CrossAxisAlignment.start,
  337. children: [
  338. Text(
  339. valueOrDefault<String>(
  340. widget!.titel,
  341. 'titel',
  342. ),
  343. style:
  344. FlutterFlowTheme.of(context).titleMedium.override(
  345. font: GoogleFonts.interTight(
  346. fontWeight: FontWeight.w600,
  347. fontStyle: FlutterFlowTheme.of(context)
  348. .titleMedium
  349. .fontStyle,
  350. ),
  351. letterSpacing: 0.0,
  352. fontWeight: FontWeight.w600,
  353. fontStyle: FlutterFlowTheme.of(context)
  354. .titleMedium
  355. .fontStyle,
  356. ),
  357. ),
  358. Column(
  359. mainAxisSize: MainAxisSize.min,
  360. crossAxisAlignment: CrossAxisAlignment.start,
  361. children: [
  362. Text(
  363. valueOrDefault<String>(
  364. widget!.adres,
  365. 'adres',
  366. ),
  367. style: FlutterFlowTheme.of(context)
  368. .bodyMedium
  369. .override(
  370. font: GoogleFonts.inter(
  371. fontWeight: FlutterFlowTheme.of(context)
  372. .bodyMedium
  373. .fontWeight,
  374. fontStyle: FlutterFlowTheme.of(context)
  375. .bodyMedium
  376. .fontStyle,
  377. ),
  378. color: FlutterFlowTheme.of(context)
  379. .secondaryText,
  380. letterSpacing: 0.0,
  381. fontWeight: FlutterFlowTheme.of(context)
  382. .bodyMedium
  383. .fontWeight,
  384. fontStyle: FlutterFlowTheme.of(context)
  385. .bodyMedium
  386. .fontStyle,
  387. ),
  388. ),
  389. Text(
  390. valueOrDefault<String>(
  391. widget!.plaats,
  392. 'plaats',
  393. ),
  394. style: FlutterFlowTheme.of(context)
  395. .bodyMedium
  396. .override(
  397. font: GoogleFonts.inter(
  398. fontWeight: FlutterFlowTheme.of(context)
  399. .bodyMedium
  400. .fontWeight,
  401. fontStyle: FlutterFlowTheme.of(context)
  402. .bodyMedium
  403. .fontStyle,
  404. ),
  405. color: FlutterFlowTheme.of(context)
  406. .secondaryText,
  407. letterSpacing: 0.0,
  408. fontWeight: FlutterFlowTheme.of(context)
  409. .bodyMedium
  410. .fontWeight,
  411. fontStyle: FlutterFlowTheme.of(context)
  412. .bodyMedium
  413. .fontStyle,
  414. ),
  415. ),
  416. ].divide(SizedBox(height: 4.0)),
  417. ),
  418. ].divide(SizedBox(height: 8.0)),
  419. ),
  420. ),
  421. ),
  422. ].divide(SizedBox(width: 16.0)),
  423. ),
  424. ),
  425. ),
  426. );
  427. }
  428. }