From 073efe5822f1aab50bec393b8ac36bf89f9783a1 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Tue, 19 Nov 2024 15:14:05 +0700 Subject: [PATCH 1/5] Improve style for error dialog --- lib/pages/chat/chat.dart | 7 +------ lib/utils/dialog/twake_dialog.dart | 33 ++++++++++++++++++++++-------- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 3e19945e27..78e5ec659a 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1581,12 +1581,7 @@ class ChatController extends State void onAcceptInvitation() async { await TwakeDialog.showFutureLoadingDialogFullScreen( future: () async { - final waitForRoom = room?.client.waitForRoomInSync( - room!.id, - join: true, - ); - await room?.join(); - await waitForRoom; + throw Exception('Not implemented'); }, ).then((_) => _tryLoadTimeline()); } diff --git a/lib/utils/dialog/twake_dialog.dart b/lib/utils/dialog/twake_dialog.dart index 39c75d05da..e4e10ef9f2 100644 --- a/lib/utils/dialog/twake_dialog.dart +++ b/lib/utils/dialog/twake_dialog.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:animations/animations.dart'; +import 'package:fluffychat/di/global/get_it_initializer.dart'; import 'package:fluffychat/pages/bootstrap/init_client_dialog.dart'; import 'package:fluffychat/resource/image_paths.dart'; import 'package:fluffychat/utils/platform_infos.dart'; @@ -22,6 +23,8 @@ class TwakeDialog { static const double lottieSizeMobile = 48; + static ResponsiveUtils responsiveUtils = getIt.get(); + static void hideLoadingDialog(BuildContext context) { if (PlatformInfos.isWeb) { if (TwakeApp.routerKey.currentContext != null) { @@ -96,15 +99,21 @@ class TwakeDialog { loadingTitleStyle: Theme.of(context).textTheme.titleLarge, maxWidth: maxWidthLoadingDialogWeb, errorTitle: L10n.of(context)!.errorDialogTitle, - errorTitleStyle: Theme.of(context).textTheme.titleLarge, + errorTitleStyle: Theme.of(context).textTheme.titleLarge?.copyWith( + color: LinagoraSysColors.material().onSurfaceVariant, + ), + errorDescriptionStyle: Theme.of(context).textTheme.titleSmall?.copyWith( + color: LinagoraSysColors.material().onSurfaceVariant, + ), errorBackLabel: L10n.of(context)!.cancel, - errorBackLabelStyle: Theme.of(context).textTheme.titleLarge?.copyWith( + errorBackLabelStyle: Theme.of(context).textTheme.labelLarge?.copyWith( color: Theme.of(context).colorScheme.primary, ), errorNextLabel: L10n.of(context)!.next, - errorNextLabelStyle: Theme.of(context).textTheme.titleLarge?.copyWith( - color: Theme.of(context).colorScheme.onPrimary, + errorNextLabelStyle: Theme.of(context).textTheme.labelLarge?.copyWith( + color: LinagoraSysColors.material().onPrimary, ), + backgroundErrorDialog: LinagoraSysColors.material().onPrimary, backgroundNextLabel: Theme.of(context).colorScheme.primary, ); } @@ -116,6 +125,7 @@ class TwakeDialog { return await showFutureLoadingDialog( context: context, future: future, + maxWidth: double.infinity, loadingIcon: LottieBuilder.asset( ImagePaths.lottieTwakeLoading, width: lottieSizeMobile, @@ -125,16 +135,23 @@ class TwakeDialog { loadingTitle: L10n.of(context)!.loading, loadingTitleStyle: Theme.of(context).textTheme.titleMedium, errorTitle: L10n.of(context)!.errorDialogTitle, - errorTitleStyle: Theme.of(context).textTheme.titleMedium, + errorTitleStyle: Theme.of(context).textTheme.headlineSmall?.copyWith( + color: LinagoraSysColors.material().onSurfaceVariant, + ), + errorDescriptionStyle: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: LinagoraSysColors.material().onSurfaceVariant, + ), errorBackLabel: L10n.of(context)!.cancel, - errorBackLabelStyle: Theme.of(context).textTheme.titleMedium?.copyWith( + errorBackLabelStyle: Theme.of(context).textTheme.labelLarge?.copyWith( color: Theme.of(context).colorScheme.primary, ), errorNextLabel: L10n.of(context)!.next, - errorNextLabelStyle: Theme.of(context).textTheme.titleMedium?.copyWith( - color: Theme.of(context).colorScheme.onPrimary, + errorNextLabelStyle: Theme.of(context).textTheme.labelLarge?.copyWith( + color: LinagoraSysColors.material().onPrimary, ), backgroundNextLabel: Theme.of(context).colorScheme.primary, + backgroundErrorDialog: LinagoraSysColors.material().onPrimary, + isMobileResponsive: true, ); } diff --git a/pubspec.lock b/pubspec.lock index 87ff185715..d235c3d746 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1361,8 +1361,8 @@ packages: dependency: "direct main" description: path: "." - ref: main - resolved-ref: "08e1e697919615410f8a855e500ef5617f90333b" + ref: update-error-dialog + resolved-ref: ceba37c01ffd5f5681f1ba30c1c3fc804d2876f3 url: "git@github.com:linagora/future-loading-dialog.git" source: git version: "0.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6c991cf796..620356a1b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: future_loading_dialog: git: url: git@github.com:linagora/future-loading-dialog.git - ref: main + ref: update-error-dialog linkfy_text: git: From 218c4627202246fc38c48b5e25cb869ff37897d2 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Tue, 19 Nov 2024 15:39:56 +0700 Subject: [PATCH 2/5] fixup! Improve style for error dialog --- lib/pages/chat/chat.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 78e5ec659a..3e19945e27 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1581,7 +1581,12 @@ class ChatController extends State void onAcceptInvitation() async { await TwakeDialog.showFutureLoadingDialogFullScreen( future: () async { - throw Exception('Not implemented'); + final waitForRoom = room?.client.waitForRoomInSync( + room!.id, + join: true, + ); + await room?.join(); + await waitForRoom; }, ).then((_) => _tryLoadTimeline()); } From fc8c55ac82c311aba93cc59deee067912a29c68a Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 20 Nov 2024 10:00:41 +0700 Subject: [PATCH 3/5] fixup! fixup! Improve style for error dialog --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index d235c3d746..7eb030531a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1362,7 +1362,7 @@ packages: description: path: "." ref: update-error-dialog - resolved-ref: ceba37c01ffd5f5681f1ba30c1c3fc804d2876f3 + resolved-ref: "478a78aa510873a6fcb107e3e98b0fb55b9ff6ff" url: "git@github.com:linagora/future-loading-dialog.git" source: git version: "0.3.0" From db8611fd6752642f227ac1c926fe5add271f2223 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 20 Nov 2024 11:56:52 +0700 Subject: [PATCH 4/5] fixup! fixup! fixup! Improve style for error dialog --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index 7eb030531a..906f79b00a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1362,7 +1362,7 @@ packages: description: path: "." ref: update-error-dialog - resolved-ref: "478a78aa510873a6fcb107e3e98b0fb55b9ff6ff" + resolved-ref: "6f5c5950038f593d25e6d178602441deed4cfdc7" url: "git@github.com:linagora/future-loading-dialog.git" source: git version: "0.3.0" From 25adec9e4e0b259045eafd4d5ea2089192865334 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 20 Nov 2024 14:18:01 +0700 Subject: [PATCH 5/5] fixup! fixup! fixup! fixup! Improve style for error dialog --- lib/utils/dialog/twake_dialog.dart | 14 ++++++++++++++ .../twake_components/twake_text_button.dart | 5 +++++ pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/utils/dialog/twake_dialog.dart b/lib/utils/dialog/twake_dialog.dart index e4e10ef9f2..5ae93aa6d3 100644 --- a/lib/utils/dialog/twake_dialog.dart +++ b/lib/utils/dialog/twake_dialog.dart @@ -357,6 +357,8 @@ Future showConfirmAlertDialog({ color: LinagoraSysColors.material() .onSurfaceVariant, ), + maxLines: 2, + overflow: TextOverflow.ellipsis, ), SizedBox( height: responsiveUtils.isMobile(context) ? 16 : 27, @@ -379,6 +381,8 @@ Future showConfirmAlertDialog({ color: LinagoraSysColors.material() .onSurfaceVariant, ), + maxLines: 3, + overflow: TextOverflow.ellipsis, ), SizedBox( height: responsiveUtils.isMobile(context) ? 24 : 65, @@ -392,6 +396,11 @@ Future showConfirmAlertDialog({ ), message: cancelLabel ?? L10n.of(context)!.cancel, + constraints: BoxConstraints( + maxWidth: responsiveUtils.isMobile(context) + ? 96 + : 112, + ), styleMessage: Theme.of(context) .textTheme .labelLarge @@ -414,6 +423,11 @@ Future showConfirmAlertDialog({ Radius.circular(100), ), ), + constraints: BoxConstraints( + maxWidth: responsiveUtils.isMobile(context) + ? 96 + : 112, + ), margin: const EdgeInsetsDirectional.symmetric( horizontal: 24.0, ), diff --git a/lib/widgets/twake_components/twake_text_button.dart b/lib/widgets/twake_components/twake_text_button.dart index f76054bf4d..ea4dc2e649 100644 --- a/lib/widgets/twake_components/twake_text_button.dart +++ b/lib/widgets/twake_components/twake_text_button.dart @@ -29,6 +29,8 @@ class TwakeTextButton extends StatelessWidget { final double? borderHover; + final BoxConstraints? constraints; + const TwakeTextButton({ super.key, required this.message, @@ -44,6 +46,7 @@ class TwakeTextButton extends StatelessWidget { this.margin = const EdgeInsetsDirectional.all(0), this.buttonDecoration, this.borderHover, + this.constraints, }); @override @@ -58,6 +61,7 @@ class TwakeTextButton extends StatelessWidget { hoverColor: hoverColor, borderRadius: BorderRadius.circular(borderHover ?? 0), child: Container( + constraints: constraints, height: 48, padding: margin, decoration: @@ -74,6 +78,7 @@ class TwakeTextButton extends StatelessWidget { Theme.of(context).textTheme.labelLarge?.copyWith( color: LinagoraSysColors.material().onPrimary, ), + overflow: TextOverflow.ellipsis, ), ), ), diff --git a/pubspec.lock b/pubspec.lock index 906f79b00a..358a845d30 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1361,8 +1361,8 @@ packages: dependency: "direct main" description: path: "." - ref: update-error-dialog - resolved-ref: "6f5c5950038f593d25e6d178602441deed4cfdc7" + ref: main + resolved-ref: "549ad29ac7153964e89ebf04b5693e5a6e50a64a" url: "git@github.com:linagora/future-loading-dialog.git" source: git version: "0.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 620356a1b0..6c991cf796 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: future_loading_dialog: git: url: git@github.com:linagora/future-loading-dialog.git - ref: update-error-dialog + ref: main linkfy_text: git: