|
|
|
@ -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'),
|
|
|
|
|
),
|
|
|
|
|