chore: Move encryption button to input row

This commit is contained in:
Christian Kußowski 2025-09-25 15:04:17 +02:00
commit 547f34f2a8
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
3 changed files with 29 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:badges/badges.dart' as b;
import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart';
@ -12,6 +13,7 @@ class EncryptionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return StreamBuilder<SyncUpdate>(
stream: Matrix.of(context)
.client
@ -27,16 +29,27 @@ class EncryptionButton extends StatelessWidget {
tooltip: room.encrypted
? L10n.of(context).encrypted
: L10n.of(context).encryptionNotEnabled,
icon: Icon(
room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined,
size: 20,
color: room.joinRules != JoinRules.public && !room.encrypted
? Colors.red
: room.joinRules != JoinRules.public &&
snapshot.data ==
EncryptionHealthState.unverifiedDevices
? Colors.orange
: null,
icon: b.Badge(
badgeAnimation: const b.BadgeAnimation.fade(),
showBadge:
snapshot.data == EncryptionHealthState.unverifiedDevices,
badgeStyle: b.BadgeStyle(
badgeColor: theme.colorScheme.error,
elevation: 4,
),
badgeContent: Text(
'!',
style: TextStyle(
fontSize: 9,
color: theme.colorScheme.onError,
fontWeight: FontWeight.bold,
),
),
child: Icon(
room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined,
size: 20,
color: theme.colorScheme.onSurface,
),
),
onPressed: () => context.go('/rooms/${room.id}/encryption'),
),