mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 11:45:10 +00:00
design: Follow up settings design
This commit is contained in:
parent
1366113823
commit
cbdea13772
5 changed files with 49 additions and 35 deletions
|
@ -760,6 +760,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"calls": "Calls",
|
||||
"customEmojisAndStickers": "Custom emojis and stickers",
|
||||
"customEmojisAndStickersBody": "Add or share custom emojis or stickers which can be used in any chat.",
|
||||
"emoteShortcode": "Emote shortcode",
|
||||
|
|
|
@ -69,19 +69,37 @@ class SettingsChatView extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
L10n.of(context)!.customEmojisAndStickers,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.customEmojisAndStickers),
|
||||
subtitle: Text(L10n.of(context)!.customEmojisAndStickersBody),
|
||||
onTap: () => context.go('/rooms/settings/chat/emotes'),
|
||||
trailing: const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Icon(Icons.emoji_emotions_outlined),
|
||||
child: Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
L10n.of(context)!.calls,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
SettingsSwitchListTile.adaptive(
|
||||
title: L10n.of(context)!.experimentalVideoCalls,
|
||||
onChanged: (b) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../widgets/matrix.dart';
|
||||
import 'settings_ignore_list_view.dart';
|
||||
|
@ -25,9 +27,20 @@ class SettingsIgnoreListController extends State<SettingsIgnoreList> {
|
|||
}
|
||||
}
|
||||
|
||||
String? errorText;
|
||||
|
||||
void ignoreUser(BuildContext context) {
|
||||
if (controller.text.isEmpty) return;
|
||||
final userId = '@${controller.text}';
|
||||
final userId = controller.text.trim();
|
||||
if (userId.isEmpty) return;
|
||||
if (!userId.isValidMatrixId || userId.sigil != '@') {
|
||||
setState(() {
|
||||
errorText = L10n.of(context)!.invalidInput;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
errorText = null;
|
||||
});
|
||||
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
|
|
|
@ -38,13 +38,13 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||
textInputAction: TextInputAction.done,
|
||||
onSubmitted: (_) => controller.ignoreUser(context),
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
hintText: 'bad_guy:domain.abc',
|
||||
prefixText: '@',
|
||||
errorText: controller.errorText,
|
||||
hintText: '@bad_guy:domain.abc',
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
labelText: L10n.of(context)!.blockUsername,
|
||||
suffixIcon: IconButton(
|
||||
tooltip: L10n.of(context)!.block,
|
||||
icon: const Icon(Icons.done_outlined),
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
onPressed: () => controller.ignoreUser(context),
|
||||
),
|
||||
),
|
||||
|
@ -57,7 +57,9 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
Divider(
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
Expanded(
|
||||
child: StreamBuilder<Object>(
|
||||
stream: client.onAccountData.stream
|
||||
|
@ -76,9 +78,11 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||
title: Text(
|
||||
s.data?.displayName ?? client.ignoredUsers[i],
|
||||
),
|
||||
subtitle:
|
||||
Text(s.data?.userId ?? client.ignoredUsers[i]),
|
||||
trailing: IconButton(
|
||||
tooltip: L10n.of(context)!.delete,
|
||||
icon: const Icon(Icons.delete_forever_outlined),
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
onPressed: () => showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () =>
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:go_router/go_router.dart';
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
@ -107,34 +106,13 @@ class SettingsSecurityView extends StatelessWidget {
|
|||
style: const TextStyle(fontFamily: 'monospace'),
|
||||
),
|
||||
),
|
||||
if (error != null)
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.warning_outlined,
|
||||
color: Colors.orange,
|
||||
),
|
||||
title: Text(
|
||||
error.toLocalizedString(context),
|
||||
style: const TextStyle(color: Colors.orange),
|
||||
),
|
||||
),
|
||||
if (capabilities?.mChangePassword?.enabled != false ||
|
||||
error != null)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password_outlined),
|
||||
trailing: error != null
|
||||
? null
|
||||
: const Icon(Icons.chevron_right_outlined),
|
||||
title: Text(
|
||||
L10n.of(context)!.changePassword,
|
||||
style: TextStyle(
|
||||
decoration:
|
||||
error == null ? null : TextDecoration.lineThrough,
|
||||
),
|
||||
),
|
||||
onTap: error != null
|
||||
? null
|
||||
: () =>
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
title: Text(L10n.of(context)!.changePassword),
|
||||
onTap: () =>
|
||||
context.go('/rooms/settings/security/password'),
|
||||
),
|
||||
ListTile(
|
||||
|
|
Loading…
Reference in a new issue