chore: Follow up connection status header

This commit is contained in:
krille-chan 2025-02-16 10:17:15 +01:00
commit 367a503123
No known key found for this signature in database
3 changed files with 26 additions and 27 deletions

View file

@ -100,12 +100,17 @@ class ChatAppBarTitle extends StatelessWidget {
) )
: Row( : Row(
children: [ children: [
Icon( SizedBox.square(
status.icon, dimension: 10,
size: 12, child: CircularProgressIndicator.adaptive(
color: status.error != null strokeWidth: 1,
? Theme.of(context).colorScheme.error value: status.progress,
: null, valueColor: status.error != null
? AlwaysStoppedAnimation<Color>(
Theme.of(context).colorScheme.error,
)
: null,
),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Expanded( Expanded(

View file

@ -79,12 +79,21 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
color: theme.colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
), ),
) )
: Icon( : Container(
status.icon, margin: const EdgeInsets.all(12),
color: status.error != null width: 8,
? theme.colorScheme.error height: 8,
: theme.colorScheme.onPrimaryContainer, child: Center(
size: 18, child: CircularProgressIndicator.adaptive(
strokeWidth: 2,
value: status.progress,
valueColor: status.error != null
? AlwaysStoppedAnimation<Color>(
theme.colorScheme.error,
)
: null,
),
),
), ),
suffixIcon: controller.isSearchMode && globalSearch suffixIcon: controller.isSearchMode && globalSearch
? controller.isSearching ? controller.isSearching

View file

@ -6,21 +6,6 @@ import 'package:matrix/matrix.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
extension SyncStatusLocalization on SyncStatusUpdate { 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) { String calcLocalizedString(BuildContext context) {
final progress = this.progress; final progress = this.progress;
switch (status) { switch (status) {