chore: Move encryption button to input row

pull/924/merge
Christian Kußowski 3 weeks ago
parent 524a63e1d6
commit 547f34f2a8
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652

@ -5,6 +5,7 @@ import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/encryption_button.dart';
import 'package:fluffychat/utils/other_party_can_receive.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar.dart';
@ -227,7 +228,6 @@ class ChatInputRow extends StatelessWidget {
),
Container(
height: height,
width: height,
alignment: Alignment.center,
child: IconButton(
tooltip: L10n.of(context).emojis,
@ -256,6 +256,11 @@ class ChatInputRow extends StatelessWidget {
onPressed: controller.emojiPickerAction,
),
),
Container(
height: height,
alignment: Alignment.center,
child: EncryptionButton(controller.room),
),
if (Matrix.of(context).isMultiAccount &&
Matrix.of(context).hasComplexBundles &&
Matrix.of(context).currentBundle!.length > 1)

@ -13,7 +13,6 @@ import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart';
import 'package:fluffychat/pages/chat/chat_app_bar_title.dart';
import 'package:fluffychat/pages/chat/chat_event_list.dart';
import 'package:fluffychat/pages/chat/encryption_button.dart';
import 'package:fluffychat/pages/chat/pinned_events.dart';
import 'package:fluffychat/pages/chat/reply_display.dart';
import 'package:fluffychat/utils/account_config.dart';
@ -127,7 +126,6 @@ class ChatView extends StatelessWidget {
icon: const Icon(Icons.call_outlined),
tooltip: L10n.of(context).placeCall,
),
EncryptionButton(controller.room),
ChatSettingsPopupMenu(controller.room, true),
];
}

@ -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…
Cancel
Save