From 9512e78441da3b056f7ca4c5563d6998ec07e757 Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 26 Jan 2025 17:30:43 +0100 Subject: [PATCH] chore: adjust design --- lib/pages/bootstrap/bootstrap_dialog.dart | 24 +++++++----- lib/pages/chat/events/audio_player.dart | 45 ++++++++++++++++------- lib/pages/chat/recording_dialog.dart | 17 +++------ 3 files changed, 51 insertions(+), 35 deletions(-) diff --git a/lib/pages/bootstrap/bootstrap_dialog.dart b/lib/pages/bootstrap/bootstrap_dialog.dart index 4b15e91fc..ebe2fdaf1 100644 --- a/lib/pages/bootstrap/bootstrap_dialog.dart +++ b/lib/pages/bootstrap/bootstrap_dialog.dart @@ -274,6 +274,7 @@ class BootstrapDialogState extends State { ElevatedButton.icon( style: ElevatedButton.styleFrom( foregroundColor: theme.colorScheme.onPrimary, + iconColor: theme.colorScheme.onPrimary, backgroundColor: theme.colorScheme.primary, ), icon: _recoveryKeyInputLoading @@ -388,6 +389,7 @@ class BootstrapDialogState extends State { style: ElevatedButton.styleFrom( backgroundColor: theme.colorScheme.errorContainer, foregroundColor: theme.colorScheme.onErrorContainer, + iconColor: theme.colorScheme.onErrorContainer, ), icon: const Icon(Icons.delete_outlined), label: Text(L10n.of(context).recoveryKeyLost), @@ -442,7 +444,7 @@ class BootstrapDialogState extends State { titleText = L10n.of(context).oopsSomethingWentWrong; body = const Icon(Icons.error_outline, color: Colors.red, size: 80); buttons.add( - OutlinedButton( + ElevatedButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(false), child: Text(L10n.of(context).close), @@ -468,7 +470,7 @@ class BootstrapDialogState extends State { ], ); buttons.add( - OutlinedButton( + ElevatedButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(false), child: Text(L10n.of(context).close), @@ -489,13 +491,17 @@ class BootstrapDialogState extends State { title: Text(titleText ?? L10n.of(context).loadingPleaseWait), ), body: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - body, - const SizedBox(height: 8), - ...buttons, - ], + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + body, + const SizedBox(height: 8), + ...buttons, + ], + ), ), ), ); diff --git a/lib/pages/chat/events/audio_player.dart b/lib/pages/chat/events/audio_player.dart index 87aa1a765..43d10ffea 100644 --- a/lib/pages/chat/events/audio_player.dart +++ b/lib/pages/chat/events/audio_player.dart @@ -9,6 +9,7 @@ import 'package:matrix/matrix.dart'; import 'package:opus_caf_converter_dart/opus_caf_converter_dart.dart'; import 'package:path_provider/path_provider.dart'; +import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/pages/chat/events/html_message.dart'; import 'package:fluffychat/utils/error_reporter.dart'; @@ -350,26 +351,42 @@ class AudioPlayerState extends State { ), ), const SizedBox(width: 8), - Badge( - isLabelVisible: audioPlayer != null, - label: audioPlayer == null - ? null - : Text( - '${audioPlayer.speed.toString()}x', - ), - backgroundColor: theme.colorScheme.secondary, - textColor: theme.colorScheme.onSecondary, - child: InkWell( - splashColor: widget.color.withAlpha(128), - borderRadius: BorderRadius.circular(64), - onTap: audioPlayer == null ? null : _toggleSpeed, + AnimatedCrossFade( + firstChild: Padding( + padding: const EdgeInsets.only(right: 8.0), child: Icon( Icons.mic_none_outlined, color: widget.color, ), ), + secondChild: Material( + color: widget.color.withAlpha(64), + borderRadius: BorderRadius.circular(AppConfig.borderRadius), + child: InkWell( + borderRadius: + BorderRadius.circular(AppConfig.borderRadius), + onTap: _toggleSpeed, + child: SizedBox( + width: 32, + height: 20, + child: Center( + child: Text( + '${audioPlayer?.speed.toString()}x', + style: TextStyle( + color: widget.color, + fontSize: 9, + ), + ), + ), + ), + ), + ), + alignment: Alignment.center, + crossFadeState: audioPlayer == null + ? CrossFadeState.showFirst + : CrossFadeState.showSecond, + duration: FluffyThemes.animationDuration, ), - const SizedBox(width: 8), ], ), ), diff --git a/lib/pages/chat/recording_dialog.dart b/lib/pages/chat/recording_dialog.dart index 68e86fa11..12ba99920 100644 --- a/lib/pages/chat/recording_dialog.dart +++ b/lib/pages/chat/recording_dialog.dart @@ -185,7 +185,7 @@ class RecordingDialogState extends State { CupertinoDialogAction( onPressed: () => Navigator.of(context, rootNavigator: false).pop(), child: Text( - L10n.of(context).cancel.toUpperCase(), + L10n.of(context).cancel, style: TextStyle( color: theme.textTheme.bodyMedium?.color?.withAlpha(150), ), @@ -194,7 +194,7 @@ class RecordingDialogState extends State { if (error != true) CupertinoDialogAction( onPressed: _stopAndSend, - child: Text(L10n.of(context).send.toUpperCase()), + child: Text(L10n.of(context).send), ), ], ); @@ -205,23 +205,16 @@ class RecordingDialogState extends State { TextButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(), child: Text( - L10n.of(context).cancel.toUpperCase(), + L10n.of(context).cancel, style: TextStyle( - color: theme.textTheme.bodyMedium?.color?.withAlpha(150), + color: theme.colorScheme.error, ), ), ), if (error != true) TextButton( onPressed: _stopAndSend, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(L10n.of(context).send.toUpperCase()), - const SizedBox(width: 4), - const Icon(Icons.send_outlined, size: 15), - ], - ), + child: Text(L10n.of(context).send), ), ], );