mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Display user emojies
This commit is contained in:
parent
032b247080
commit
e6df696077
@ -83,8 +83,10 @@ class UsersHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get information about a single user. Throws in case of failure
|
/// Get information about a single user. Throws in case of failure
|
||||||
Future<User> getSingleWithThrow(int user) async {
|
Future<User> getSingleWithThrow(int user,
|
||||||
return (await getListWithThrow(Set<int>()..add(user)))[0];
|
{bool forceDownload = false}) async {
|
||||||
|
return (await getListWithThrow(Set<int>()..add(user),
|
||||||
|
forceDownload: forceDownload))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get users information from a given [Set]
|
/// Get users information from a given [Set]
|
||||||
|
@ -1,4 +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/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';
|
||||||
@ -33,7 +34,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
|
|||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: tr("Account settings"),
|
title: tr("Account settings"),
|
||||||
tiles: [
|
tiles: [
|
||||||
|
// General settings
|
||||||
SettingsTile(
|
SettingsTile(
|
||||||
title: tr("General settings"),
|
title: tr("General settings"),
|
||||||
subtitle: tr("Configure the main settings of your account"),
|
subtitle: tr("Configure the main settings of your account"),
|
||||||
@ -41,6 +42,15 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
|
|||||||
onTap: () => _openSection(GeneralAccountSettingsScreen()),
|
onTap: () => _openSection(GeneralAccountSettingsScreen()),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Emoticons
|
||||||
|
SettingsTile(
|
||||||
|
title: tr("Custom emojis"),
|
||||||
|
subtitle: tr("Set your own emoticon shorcuts"),
|
||||||
|
leading: Icon(Icons.insert_emoticon),
|
||||||
|
onTap: () => _openSection(EmojisAccountSettings()),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Account image
|
||||||
SettingsTile(
|
SettingsTile(
|
||||||
title: tr("Account image"),
|
title: tr("Account image"),
|
||||||
subtitle: tr("Customize your account image"),
|
subtitle: tr("Customize your account image"),
|
||||||
|
58
lib/ui/routes/account_settings/emojies_account_settings.dart
Normal file
58
lib/ui/routes/account_settings/emojies_account_settings.dart
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import 'package:comunic/helpers/users_helper.dart';
|
||||||
|
import 'package:comunic/models/user.dart';
|
||||||
|
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||||
|
import 'package:comunic/ui/widgets/network_image_widget.dart';
|
||||||
|
import 'package:comunic/utils/account_utils.dart';
|
||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Emojies account settings
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
|
class EmojisAccountSettings extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(tr("Emojies settings")),
|
||||||
|
),
|
||||||
|
body: _EmojiesAccountBody(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EmojiesAccountBody extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
__EmojiesAccountBodyState createState() => __EmojiesAccountBodyState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class __EmojiesAccountBodyState extends State<_EmojiesAccountBody> {
|
||||||
|
User _user;
|
||||||
|
|
||||||
|
Future<void> _reload() async {
|
||||||
|
_user = await UsersHelper().getSingleWithThrow(
|
||||||
|
userID(),
|
||||||
|
forceDownload: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AsyncScreenWidget(
|
||||||
|
onReload: _reload,
|
||||||
|
onBuild: _buildSettings,
|
||||||
|
errorMessage: tr("Could not refresh user information!"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSettings() {
|
||||||
|
return ListView(
|
||||||
|
children: _user.customEmojies
|
||||||
|
.map((u) => ListTile(
|
||||||
|
leading: NetworkImageWidget(url: u.url, width: 50),
|
||||||
|
title: Text(u.shortcut),
|
||||||
|
))
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user