1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-29 08:16:28 +00:00

Fix issue

This commit is contained in:
Pierre HUBERT 2020-04-29 13:44:09 +02:00
parent 225df61aa0
commit 25f72bd11c
2 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import 'package:comunic/ui/routes/account_settings/account_image_settings.dart'; import 'package:comunic/ui/routes/account_settings/account_image_settings.dart';
import 'package:comunic/ui/routes/account_settings/emojies_account_settings.dart'; import 'package:comunic/ui/routes/account_settings/custom_emojies_account_settings.dart';
import 'package:comunic/ui/routes/account_settings/general_account_settings.dart'; import 'package:comunic/ui/routes/account_settings/general_account_settings.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -47,7 +47,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
title: tr("Custom emojis"), title: tr("Custom emojis"),
subtitle: tr("Set your own emoticon shorcuts"), subtitle: tr("Set your own emoticon shorcuts"),
leading: Icon(Icons.insert_emoticon), leading: Icon(Icons.insert_emoticon),
onTap: () => _openSection(EmojisAccountSettings()), onTap: () => _openSection(CustomEmojisAccountSettings()),
), ),
// Account image // Account image

View File

@ -17,24 +17,25 @@ import 'package:flutter/material.dart';
/// ///
/// @author Pierre Hubert /// @author Pierre Hubert
class EmojisAccountSettings extends StatelessWidget { class CustomEmojisAccountSettings extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(tr("Emojies settings")), title: Text(tr("Custom emojies settings")),
), ),
body: _EmojiesAccountBody(), body: _CustomEmojiesAccountBody(),
); );
} }
} }
class _EmojiesAccountBody extends StatefulWidget { class _CustomEmojiesAccountBody extends StatefulWidget {
@override @override
__EmojiesAccountBodyState createState() => __EmojiesAccountBodyState(); _CustomEmojiesAccountBodyState createState() =>
_CustomEmojiesAccountBodyState();
} }
class __EmojiesAccountBodyState extends State<_EmojiesAccountBody> { class _CustomEmojiesAccountBodyState extends State<_CustomEmojiesAccountBody> {
User _user; User _user;
final _key = GlobalKey<AsyncScreenWidgetState>(); final _key = GlobalKey<AsyncScreenWidgetState>();
@ -89,9 +90,11 @@ class __EmojiesAccountBodyState extends State<_EmojiesAccountBody> {
try { try {
final newEmoji = await showDialog<NewEmoji>( final newEmoji = await showDialog<NewEmoji>(
context: context, context: context,
builder: (c) => _NewEmojiDialog(), builder: (c) => _NewCustomEmojiDialog(),
); );
if (newEmoji == null) return;
await SettingsHelper.uploadNewCustomEmoji(newEmoji); await SettingsHelper.uploadNewCustomEmoji(newEmoji);
} catch (e, stack) { } catch (e, stack) {
print("Could not add a new emoji: $e\n$stack"); print("Could not add a new emoji: $e\n$stack");
@ -102,12 +105,13 @@ class __EmojiesAccountBodyState extends State<_EmojiesAccountBody> {
} }
} }
class _NewEmojiDialog extends StatefulWidget { /// Dialog used to upload new custom emojies
class _NewCustomEmojiDialog extends StatefulWidget {
@override @override
__NewEmojiDialogState createState() => __NewEmojiDialogState(); _NewCustomEmojiDialogState createState() => _NewCustomEmojiDialogState();
} }
class __NewEmojiDialogState extends State<_NewEmojiDialog> { class _NewCustomEmojiDialogState extends State<_NewCustomEmojiDialog> {
final _controller = TextEditingController(); final _controller = TextEditingController();
File _file; File _file;