From 2398926d4cc9bd27fcc34baefa1cc3e0c92c9222 Mon Sep 17 00:00:00 2001 From: thePeras Date: Thu, 8 Aug 2024 22:36:05 +0100 Subject: [PATCH 1/2] Services Card --- packages/uni_ui/lib/service_card.dart | 54 +++++++++++++++++++++++++++ packages/uni_ui/pubspec.lock | 8 ++++ packages/uni_ui/pubspec.yaml | 1 + 3 files changed, 63 insertions(+) create mode 100644 packages/uni_ui/lib/service_card.dart diff --git a/packages/uni_ui/lib/service_card.dart b/packages/uni_ui/lib/service_card.dart new file mode 100644 index 000000000..e2c980ef7 --- /dev/null +++ b/packages/uni_ui/lib/service_card.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; +import 'package:uni_ui/generic_card.dart'; + +class ServiceCard extends StatelessWidget { + const ServiceCard({ + super.key, + required this.name, + required this.openingHours, + }); + + final String name; + final List openingHours; + + @override + Widget build(BuildContext context) { + return GenericCard( + key: key, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + name, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.headlineMedium!, + ), + ], + ), + const SizedBox(height: 5), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: Theme.of(context).textTheme.bodyMedium!.color, + size: 20, + ), + const SizedBox(width: 5), + Column( + children: [ + for (var i = 0; i < openingHours.length; i++) + Text(openingHours[i], + style: Theme.of(context).textTheme.bodySmall), + ], + ), + ], + ), + ], + ), + ); + } +} diff --git a/packages/uni_ui/pubspec.lock b/packages/uni_ui/pubspec.lock index 25a63aad9..1f09ca040 100644 --- a/packages/uni_ui/pubspec.lock +++ b/packages/uni_ui/pubspec.lock @@ -363,6 +363,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + phosphor_flutter: + dependency: "direct main" + description: + name: phosphor_flutter + sha256: "8a14f238f28a0b54842c5a4dc20676598dd4811fcba284ed828bd5a262c11fde" + url: "https://pub.dev" + source: hosted + version: "2.1.0" pool: dependency: transitive description: diff --git a/packages/uni_ui/pubspec.yaml b/packages/uni_ui/pubspec.yaml index 9f518255d..71d7cbb74 100644 --- a/packages/uni_ui/pubspec.yaml +++ b/packages/uni_ui/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: figma_squircle: ^0.5.3 flutter: sdk: flutter + phosphor_flutter: ^2.1.0 dev_dependencies: custom_lint: ^0.6.4 From 4f758e6b45b93e91c528d4d1e2466eff0284c35c Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 2 Oct 2024 07:50:53 +0100 Subject: [PATCH 2/2] map iterate --- packages/uni_ui/lib/service_card.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/uni_ui/lib/service_card.dart b/packages/uni_ui/lib/service_card.dart index e2c980ef7..2628c7f1e 100644 --- a/packages/uni_ui/lib/service_card.dart +++ b/packages/uni_ui/lib/service_card.dart @@ -39,12 +39,13 @@ class ServiceCard extends StatelessWidget { ), const SizedBox(width: 5), Column( - children: [ - for (var i = 0; i < openingHours.length; i++) - Text(openingHours[i], - style: Theme.of(context).textTheme.bodySmall), - ], - ), + children: openingHours.map((hour) { + return Text( + hour, + style: Theme.of(context).textTheme.bodySmall, + ); + }).toList(), + ) ], ), ],