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