From 367a503123a606594a052d91539e7069838c289a Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 16 Feb 2025 10:17:15 +0100 Subject: [PATCH] chore: Follow up connection status header --- lib/pages/chat/chat_app_bar_title.dart | 17 +++++++++++------ lib/pages/chat_list/chat_list_header.dart | 21 +++++++++++++++------ lib/utils/sync_status_localization.dart | 15 --------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/lib/pages/chat/chat_app_bar_title.dart b/lib/pages/chat/chat_app_bar_title.dart index 68eb56996..fe78ab533 100644 --- a/lib/pages/chat/chat_app_bar_title.dart +++ b/lib/pages/chat/chat_app_bar_title.dart @@ -100,12 +100,17 @@ class ChatAppBarTitle extends StatelessWidget { ) : Row( children: [ - Icon( - status.icon, - size: 12, - color: status.error != null - ? Theme.of(context).colorScheme.error - : null, + SizedBox.square( + dimension: 10, + child: CircularProgressIndicator.adaptive( + strokeWidth: 1, + value: status.progress, + valueColor: status.error != null + ? AlwaysStoppedAnimation( + Theme.of(context).colorScheme.error, + ) + : null, + ), ), const SizedBox(width: 4), Expanded( diff --git a/lib/pages/chat_list/chat_list_header.dart b/lib/pages/chat_list/chat_list_header.dart index f5f115c26..b2a2aa761 100644 --- a/lib/pages/chat_list/chat_list_header.dart +++ b/lib/pages/chat_list/chat_list_header.dart @@ -79,12 +79,21 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { color: theme.colorScheme.onPrimaryContainer, ), ) - : Icon( - status.icon, - color: status.error != null - ? theme.colorScheme.error - : theme.colorScheme.onPrimaryContainer, - size: 18, + : Container( + margin: const EdgeInsets.all(12), + width: 8, + height: 8, + child: Center( + child: CircularProgressIndicator.adaptive( + strokeWidth: 2, + value: status.progress, + valueColor: status.error != null + ? AlwaysStoppedAnimation( + theme.colorScheme.error, + ) + : null, + ), + ), ), suffixIcon: controller.isSearchMode && globalSearch ? controller.isSearching diff --git a/lib/utils/sync_status_localization.dart b/lib/utils/sync_status_localization.dart index 0cccbc7b9..1ea8f14e1 100644 --- a/lib/utils/sync_status_localization.dart +++ b/lib/utils/sync_status_localization.dart @@ -6,21 +6,6 @@ import 'package:matrix/matrix.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart'; extension SyncStatusLocalization on SyncStatusUpdate { - IconData get icon { - switch (status) { - case SyncStatus.waitingForResponse: - return Icons.hourglass_empty_outlined; - case SyncStatus.error: - return Icons.cloud_off_outlined; - case SyncStatus.processing: - return Icons.hourglass_top_outlined; - case SyncStatus.cleaningUp: - return Icons.hourglass_bottom_outlined; - case SyncStatus.finished: - return Icons.hourglass_full_outlined; - } - } - String calcLocalizedString(BuildContext context) { final progress = this.progress; switch (status) {