chore: Move encryption button to input row
This commit is contained in:
parent
524a63e1d6
commit
547f34f2a8
3 changed files with 29 additions and 13 deletions
|
|
@ -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'),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue