|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
|
import 'package:fluffychat/config/setting_keys.dart';
|
|
|
|
@ -88,6 +89,41 @@ class SettingsSecurityView extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
Divider(color: theme.dividerColor),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
L10n.of(context).shareKeysWith,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: theme.colorScheme.secondary,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
subtitle: Text(L10n.of(context).shareKeysWithDescription),
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Material(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius / 2),
|
|
|
|
|
color: theme.colorScheme.onInverseSurface,
|
|
|
|
|
child: DropdownButton<ShareKeysWith>(
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(AppConfig.borderRadius / 2),
|
|
|
|
|
underline: const SizedBox.shrink(),
|
|
|
|
|
value: Matrix.of(context).client.shareKeysWith,
|
|
|
|
|
items: ShareKeysWith.values
|
|
|
|
|
.map(
|
|
|
|
|
(share) => DropdownMenuItem(
|
|
|
|
|
value: share,
|
|
|
|
|
child: Text(share.localized(L10n.of(context))),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList(),
|
|
|
|
|
onChanged: controller.changeShareKeysWith,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(color: theme.dividerColor),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
L10n.of(context).account,
|
|
|
|
@ -142,3 +178,18 @@ class SettingsSecurityView extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension on ShareKeysWith {
|
|
|
|
|
String localized(L10n l10n) {
|
|
|
|
|
switch (this) {
|
|
|
|
|
case ShareKeysWith.all:
|
|
|
|
|
return l10n.allDevices;
|
|
|
|
|
case ShareKeysWith.crossVerifiedIfEnabled:
|
|
|
|
|
return l10n.crossVerifiedDevicesIfEnabled;
|
|
|
|
|
case ShareKeysWith.crossVerified:
|
|
|
|
|
return l10n.crossVerifiedDevices;
|
|
|
|
|
case ShareKeysWith.directlyVerifiedOnly:
|
|
|
|
|
return l10n.verifiedDevicesOnly;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|