From 574bf3da2be9ee8346ab575522f98293207c6fdd Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Thu, 8 Aug 2024 01:08:19 +0100 Subject: [PATCH 1/4] Dialog/Modal Widget --- packages/uni_ui/lib/modal/modal.dart | 27 +++++++++ .../lib/modal/widgets/enrollment_info.dart | 56 +++++++++++++++++++ .../uni_ui/lib/modal/widgets/info_row.dart | 43 ++++++++++++++ .../uni_ui/lib/modal/widgets/person_info.dart | 24 ++++++++ .../lib/modal/widgets/service_info.dart | 48 ++++++++++++++++ packages/uni_ui/lib/theme.dart | 1 + packages/uni_ui/pubspec.lock | 8 +++ packages/uni_ui/pubspec.yaml | 1 + 8 files changed, 208 insertions(+) create mode 100644 packages/uni_ui/lib/modal/modal.dart create mode 100644 packages/uni_ui/lib/modal/widgets/enrollment_info.dart create mode 100644 packages/uni_ui/lib/modal/widgets/info_row.dart create mode 100644 packages/uni_ui/lib/modal/widgets/person_info.dart create mode 100644 packages/uni_ui/lib/modal/widgets/service_info.dart diff --git a/packages/uni_ui/lib/modal/modal.dart b/packages/uni_ui/lib/modal/modal.dart new file mode 100644 index 000000000..d60072864 --- /dev/null +++ b/packages/uni_ui/lib/modal/modal.dart @@ -0,0 +1,27 @@ +import 'package:figma_squircle/figma_squircle.dart'; +import 'package:flutter/material.dart'; + +class ModalDialog extends StatelessWidget { + const ModalDialog({ + required this.children, + }); + + final List children; + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Theme.of(context).colorScheme.surface, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: ClipSmoothRect( + radius: SmoothBorderRadius(cornerRadius: 20, cornerSmoothing: 1), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: children, + ), + ), + )); + } +} diff --git a/packages/uni_ui/lib/modal/widgets/enrollment_info.dart b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart new file mode 100644 index 000000000..f19808355 --- /dev/null +++ b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; +import 'package:uni_ui/theme.dart'; + +class ModalEnrollementInfo extends StatelessWidget { + const ModalEnrollementInfo({required this.enrollements}); + + final Map enrollements; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(1.5), + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Theme.of(context).dividerColor, width: 1))), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Enrollments", style: Theme.of(context).textTheme.bodyMedium), + Wrap( + spacing: 1, + direction: Axis.horizontal, + children: createRows(context), + ) + ], + )); + } + + List createRows(BuildContext context) { + return enrollements.entries.map((entry) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(entry.key, + style: Theme.of(context) + .textTheme + .labelLarge + ?.copyWith(color: Theme.of(context).primaryColor)), + Container( + padding: const EdgeInsets.all(4.0), + margin: const EdgeInsets.all(3.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(20)), + color: Theme.of(context).primaryColor), + child: Text( + entry.value, + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: pureWhite, + ), + )) + ], + ); + }).toList(); + } +} diff --git a/packages/uni_ui/lib/modal/widgets/info_row.dart b/packages/uni_ui/lib/modal/widgets/info_row.dart new file mode 100644 index 000000000..7a4f4141f --- /dev/null +++ b/packages/uni_ui/lib/modal/widgets/info_row.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; + +class ModalInfoRow extends StatelessWidget { + const ModalInfoRow( + {super.key, + required this.title, + required this.description, + required this.icon}); + + final String title; + final String description; + final PhosphorIconData icon; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(3.0), + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Theme.of(context).dividerColor, width: 1))), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text(description, + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Theme.of(context).secondaryHeaderColor)), + ], + ), + ), + PhosphorIcon(icon as IconData), + ], + )); + } +} diff --git a/packages/uni_ui/lib/modal/widgets/person_info.dart b/packages/uni_ui/lib/modal/widgets/person_info.dart new file mode 100644 index 000000000..5273116bc --- /dev/null +++ b/packages/uni_ui/lib/modal/widgets/person_info.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +class ModalPersonInfo extends StatelessWidget { + const ModalPersonInfo({this.image, required this.name}); + + final Image? image; + final String name; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + CircleAvatar( + radius: 60.0, + backgroundColor: Colors.green, // TODO: CHANGE TO IMAGE + ), + Text( + name, + style: Theme.of(context).textTheme.displaySmall, + ) + ], + ); + } +} diff --git a/packages/uni_ui/lib/modal/widgets/service_info.dart b/packages/uni_ui/lib/modal/widgets/service_info.dart new file mode 100644 index 000000000..b3f703e47 --- /dev/null +++ b/packages/uni_ui/lib/modal/widgets/service_info.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; +import 'package:uni_ui/theme.dart'; + +class ModalServiceInfo extends StatelessWidget { + const ModalServiceInfo({ + required this.name, + required this.morningDuration, + required this.afternoonDuration, + }); + + final String name; + final String morningDuration; + final String afternoonDuration; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Text( + name, + style: + TextStyle(fontSize: 25.0, color: Theme.of(context).primaryColor), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: darkGray, + duotoneSecondaryColor: normalGray, + ), + Column( + children: [ + Text(morningDuration, + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Theme.of(context).secondaryHeaderColor)), + Text(afternoonDuration, + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Theme.of(context).secondaryHeaderColor)), + ], + ) + ], + ) + ], + ); + } +} diff --git a/packages/uni_ui/lib/theme.dart b/packages/uni_ui/lib/theme.dart index 02ec51da9..2c2fd7686 100644 --- a/packages/uni_ui/lib/theme.dart +++ b/packages/uni_ui/lib/theme.dart @@ -45,5 +45,6 @@ ThemeData lightTheme = ThemeData( dividerColor: lightGray, hintColor: lightGray, indicatorColor: darkRed, + secondaryHeaderColor: normalGray, iconTheme: const IconThemeData(color: darkRed), ); 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 2d55ffc8b7627615615260979efdeb9e980581ac Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Thu, 8 Aug 2024 17:01:48 +0100 Subject: [PATCH 2/4] Comply with requested changes --- packages/uni_ui/lib/modal/modal.dart | 15 ++--- .../lib/modal/widgets/enrollment_info.dart | 62 +++++++++---------- .../uni_ui/lib/modal/widgets/info_row.dart | 8 ++- .../lib/modal/widgets/service_info.dart | 20 ++---- 4 files changed, 50 insertions(+), 55 deletions(-) diff --git a/packages/uni_ui/lib/modal/modal.dart b/packages/uni_ui/lib/modal/modal.dart index d60072864..907bd7f6c 100644 --- a/packages/uni_ui/lib/modal/modal.dart +++ b/packages/uni_ui/lib/modal/modal.dart @@ -11,17 +11,18 @@ class ModalDialog extends StatelessWidget { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: Theme.of(context).colorScheme.surface, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: ClipSmoothRect( - radius: SmoothBorderRadius(cornerRadius: 20, cornerSmoothing: 1), + backgroundColor: Colors.transparent, + child: ClipSmoothRect( + radius: SmoothBorderRadius(cornerRadius: 30, cornerSmoothing: 1), + child: Container( + padding: const EdgeInsets.all(20.0), + color: Theme.of(context).colorScheme.surface, child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: children, ), - ), - )); + )), + ); } } diff --git a/packages/uni_ui/lib/modal/widgets/enrollment_info.dart b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart index f19808355..1ffc869a8 100644 --- a/packages/uni_ui/lib/modal/widgets/enrollment_info.dart +++ b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart @@ -19,38 +19,38 @@ class ModalEnrollementInfo extends StatelessWidget { children: [ Text("Enrollments", style: Theme.of(context).textTheme.bodyMedium), Wrap( - spacing: 1, - direction: Axis.horizontal, - children: createRows(context), - ) + spacing: 1, + direction: Axis.horizontal, + children: enrollements.entries.map((entry) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(entry.key, + style: Theme.of(context) + .textTheme + .labelLarge + ?.copyWith( + color: Theme.of(context).primaryColor)), + Container( + padding: const EdgeInsets.all(4.0), + margin: const EdgeInsets.all(3.0), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(20)), + color: Theme.of(context).primaryColor), + child: Text( + entry.value, + style: Theme.of(context) + .textTheme + .labelSmall + ?.copyWith( + color: pureWhite, + ), + )) + ], + ); + }).toList()) ], )); } - - List createRows(BuildContext context) { - return enrollements.entries.map((entry) { - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(entry.key, - style: Theme.of(context) - .textTheme - .labelLarge - ?.copyWith(color: Theme.of(context).primaryColor)), - Container( - padding: const EdgeInsets.all(4.0), - margin: const EdgeInsets.all(3.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(20)), - color: Theme.of(context).primaryColor), - child: Text( - entry.value, - style: Theme.of(context).textTheme.labelSmall?.copyWith( - color: pureWhite, - ), - )) - ], - ); - }).toList(); - } } diff --git a/packages/uni_ui/lib/modal/widgets/info_row.dart b/packages/uni_ui/lib/modal/widgets/info_row.dart index 7a4f4141f..e6ac6c17b 100644 --- a/packages/uni_ui/lib/modal/widgets/info_row.dart +++ b/packages/uni_ui/lib/modal/widgets/info_row.dart @@ -6,11 +6,13 @@ class ModalInfoRow extends StatelessWidget { {super.key, required this.title, required this.description, - required this.icon}); + required this.icon, + this.onPressed}); final String title; final String description; - final PhosphorIconData icon; + final IconData icon; + final void Function()? onPressed; @override Widget build(BuildContext context) { @@ -36,7 +38,7 @@ class ModalInfoRow extends StatelessWidget { ], ), ), - PhosphorIcon(icon as IconData), + IconButton(onPressed: onPressed, icon: PhosphorIcon(icon)) ], )); } diff --git a/packages/uni_ui/lib/modal/widgets/service_info.dart b/packages/uni_ui/lib/modal/widgets/service_info.dart index b3f703e47..1a93d3a43 100644 --- a/packages/uni_ui/lib/modal/widgets/service_info.dart +++ b/packages/uni_ui/lib/modal/widgets/service_info.dart @@ -3,15 +3,10 @@ import 'package:phosphor_flutter/phosphor_flutter.dart'; import 'package:uni_ui/theme.dart'; class ModalServiceInfo extends StatelessWidget { - const ModalServiceInfo({ - required this.name, - required this.morningDuration, - required this.afternoonDuration, - }); + const ModalServiceInfo({required this.name, required this.durations}); final String name; - final String morningDuration; - final String afternoonDuration; + final List durations; @override Widget build(BuildContext context) { @@ -31,14 +26,11 @@ class ModalServiceInfo extends StatelessWidget { duotoneSecondaryColor: normalGray, ), Column( - children: [ - Text(morningDuration, + children: durations.map((duration) { + return Text(duration, style: Theme.of(context).textTheme.bodySmall!.copyWith( - color: Theme.of(context).secondaryHeaderColor)), - Text(afternoonDuration, - style: Theme.of(context).textTheme.bodySmall!.copyWith( - color: Theme.of(context).secondaryHeaderColor)), - ], + color: Theme.of(context).secondaryHeaderColor)); + }).toList(), ) ], ) From 00bff1822208432d1c4da8f57048e6fbb8f9f694 Mon Sep 17 00:00:00 2001 From: Rubem Neto Date: Fri, 16 Aug 2024 21:58:25 +0100 Subject: [PATCH 3/4] More minor changes --- .../lib/modal/widgets/enrollment_info.dart | 3 +- .../uni_ui/lib/modal/widgets/person_info.dart | 26 +++++----- .../lib/modal/widgets/service_info.dart | 48 ++++++++++--------- 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/packages/uni_ui/lib/modal/widgets/enrollment_info.dart b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart index 1ffc869a8..294057bb3 100644 --- a/packages/uni_ui/lib/modal/widgets/enrollment_info.dart +++ b/packages/uni_ui/lib/modal/widgets/enrollment_info.dart @@ -9,7 +9,8 @@ class ModalEnrollementInfo extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - padding: const EdgeInsets.all(1.5), + padding: const EdgeInsets.only(top: 10.0), + width: double.infinity, decoration: BoxDecoration( border: Border( top: BorderSide( diff --git a/packages/uni_ui/lib/modal/widgets/person_info.dart b/packages/uni_ui/lib/modal/widgets/person_info.dart index 5273116bc..e264d09c5 100644 --- a/packages/uni_ui/lib/modal/widgets/person_info.dart +++ b/packages/uni_ui/lib/modal/widgets/person_info.dart @@ -8,17 +8,21 @@ class ModalPersonInfo extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - children: [ - CircleAvatar( - radius: 60.0, - backgroundColor: Colors.green, // TODO: CHANGE TO IMAGE - ), - Text( - name, - style: Theme.of(context).textTheme.displaySmall, - ) - ], + return Padding( + padding: EdgeInsets.only(bottom: 20.0), + child: Column( + children: [ + CircleAvatar( + radius: 60.0, + backgroundImage: image?.image, + backgroundColor: Colors.green, + ), + Text( + name, + style: Theme.of(context).textTheme.displaySmall, + ) + ], + ), ); } } diff --git a/packages/uni_ui/lib/modal/widgets/service_info.dart b/packages/uni_ui/lib/modal/widgets/service_info.dart index 1a93d3a43..32c011d9b 100644 --- a/packages/uni_ui/lib/modal/widgets/service_info.dart +++ b/packages/uni_ui/lib/modal/widgets/service_info.dart @@ -10,31 +10,33 @@ class ModalServiceInfo extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - children: [ - Text( - name, - style: - TextStyle(fontSize: 25.0, color: Theme.of(context).primaryColor), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + return Padding( + padding: EdgeInsets.only(bottom: 20.0), + child: Column( children: [ - PhosphorIcon( - PhosphorIcons.clock(PhosphorIconsStyle.duotone), - color: darkGray, - duotoneSecondaryColor: normalGray, + Text( + name, + style: TextStyle( + fontSize: 25.0, color: Theme.of(context).primaryColor), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: darkGray, + duotoneSecondaryColor: normalGray, + ), + Column( + children: durations.map((duration) { + return Text(duration, + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Theme.of(context).secondaryHeaderColor)); + }).toList(), + ) + ], ), - Column( - children: durations.map((duration) { - return Text(duration, - style: Theme.of(context).textTheme.bodySmall!.copyWith( - color: Theme.of(context).secondaryHeaderColor)); - }).toList(), - ) ], - ) - ], - ); + )); } } From 418b9b253c8d81a44eaf87b45c685f4b89857e14 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 21 Aug 2024 15:13:07 +0000 Subject: [PATCH 4/4] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index d1a078ac2..339705b9a 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.9.0-beta.23+286 +1.9.0-beta.24+287 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 289b22276..df57cc422 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.9.0-beta.23+286 +version: 1.9.0-beta.24+287 environment: sdk: ">=3.4.0 <4.0.0"