horecagelegenheidoverzicht_kaart_widget.dart 19 KB

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