chore: Adjust encryption page design
This commit is contained in:
parent
50995e57ff
commit
7ff6d7b401
1 changed files with 61 additions and 60 deletions
|
|
@ -9,6 +9,7 @@ import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart';
|
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart';
|
||||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||||
|
|
||||||
class ChatEncryptionSettingsView extends StatelessWidget {
|
class ChatEncryptionSettingsView extends StatelessWidget {
|
||||||
|
|
@ -58,7 +59,6 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
||||||
size: 128,
|
size: 128,
|
||||||
color: theme.colorScheme.onInverseSurface,
|
color: theme.colorScheme.onInverseSurface,
|
||||||
),
|
),
|
||||||
const Divider(),
|
|
||||||
if (room.isDirectChat)
|
if (room.isDirectChat)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
|
@ -107,72 +107,73 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: deviceKeys.length,
|
itemCount: deviceKeys.length,
|
||||||
itemBuilder: (BuildContext context, int i) =>
|
itemBuilder: (BuildContext context, int i) => Column(
|
||||||
SwitchListTile(
|
mainAxisSize: MainAxisSize.min,
|
||||||
value: !deviceKeys[i].blocked,
|
children: [
|
||||||
activeThumbColor: deviceKeys[i].verified
|
if (i == 0 ||
|
||||||
? Colors.green
|
deviceKeys[i].userId !=
|
||||||
: Colors.orange,
|
deviceKeys[i - 1].userId) ...[
|
||||||
onChanged: (_) =>
|
const Divider(),
|
||||||
controller.toggleDeviceKey(deviceKeys[i]),
|
FutureBuilder(
|
||||||
title: Row(
|
future: room.client
|
||||||
children: [
|
.getUserProfile(deviceKeys[i].userId),
|
||||||
Icon(
|
builder: (context, snapshot) {
|
||||||
deviceKeys[i].verified
|
final displayname =
|
||||||
? Icons.verified_outlined
|
snapshot.data?.displayname ??
|
||||||
: deviceKeys[i].blocked
|
deviceKeys[i].userId.localpart ??
|
||||||
? Icons.block_outlined
|
deviceKeys[i].userId;
|
||||||
: Icons.info_outlined,
|
return ListTile(
|
||||||
color: deviceKeys[i].verified
|
leading: Avatar(
|
||||||
? Colors.green
|
name: displayname,
|
||||||
: deviceKeys[i].blocked
|
mxContent: snapshot.data?.avatarUrl,
|
||||||
? Colors.red
|
|
||||||
: Colors.orange,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
deviceKeys[i].deviceId ??
|
|
||||||
L10n.of(context).unknownDevice,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Flexible(
|
|
||||||
fit: FlexFit.loose,
|
|
||||||
child: Material(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
AppConfig.borderRadius,
|
|
||||||
),
|
),
|
||||||
side: BorderSide(
|
title: Text(displayname),
|
||||||
color: theme.colorScheme.primary,
|
subtitle: Text(deviceKeys[i].userId),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
color: theme.colorScheme.primaryContainer,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: Text(
|
|
||||||
deviceKeys[i].userId,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
color: theme.colorScheme.primary,
|
|
||||||
fontSize: 12,
|
|
||||||
fontStyle: FontStyle.italic,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
SwitchListTile(
|
||||||
subtitle: Text(
|
value: !deviceKeys[i].blocked,
|
||||||
deviceKeys[i].ed25519Key?.beautified ??
|
activeThumbColor: deviceKeys[i].verified
|
||||||
L10n.of(context).unknownEncryptionAlgorithm,
|
? Colors.green
|
||||||
style: TextStyle(
|
: Colors.orange,
|
||||||
fontFamily: 'RobotoMono',
|
onChanged: (_) =>
|
||||||
color: theme.colorScheme.secondary,
|
controller.toggleDeviceKey(deviceKeys[i]),
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
deviceKeys[i].verified
|
||||||
|
? L10n.of(context).verified
|
||||||
|
: deviceKeys[i].blocked
|
||||||
|
? L10n.of(context).blocked
|
||||||
|
: L10n.of(context).unverified,
|
||||||
|
style: TextStyle(
|
||||||
|
color: deviceKeys[i].verified
|
||||||
|
? Colors.green
|
||||||
|
: deviceKeys[i].blocked
|
||||||
|
? Colors.red
|
||||||
|
: Colors.orange,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(' | ID: '),
|
||||||
|
Text(
|
||||||
|
deviceKeys[i].deviceId ??
|
||||||
|
L10n.of(context).unknownDevice,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
deviceKeys[i].ed25519Key?.beautified ??
|
||||||
|
L10n.of(context).unknownEncryptionAlgorithm,
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'RobotoMono',
|
||||||
|
color: theme.colorScheme.secondary,
|
||||||
|
fontSize: 11,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue