From 276ddc68931819e690148d06e59931e653c209f4 Mon Sep 17 00:00:00 2001 From: Sun Date: Thu, 3 Jun 2021 17:33:05 +0800 Subject: [PATCH] change input style --- lib/apps/chat/list.dart | 2 +- lib/apps/group_chat/add.dart | 26 ++++++++++++++------------ lib/apps/group_chat/detail.dart | 5 ----- lib/apps/group_chat/list.dart | 2 +- lib/l10n/localizations.dart | 2 ++ lib/l10n/localizations_en.dart | 4 ++++ lib/l10n/localizations_zh.dart | 6 +++++- lib/pages/home.dart | 18 +++++++++++++++++- 8 files changed, 44 insertions(+), 21 deletions(-) diff --git a/lib/apps/chat/list.dart b/lib/apps/chat/list.dart index aa42c13..b42a494 100644 --- a/lib/apps/chat/list.dart +++ b/lib/apps/chat/list.dart @@ -30,7 +30,7 @@ class _ChatListState extends State { return Scaffold( appBar: AppBar( - title: Text(lang.contact), + title: Text(lang.friends), bottom: PreferredSize( child: Container(color: const Color(0x40ADB0BB), height: 1.0), preferredSize: Size.fromHeight(1.0) diff --git a/lib/apps/group_chat/add.dart b/lib/apps/group_chat/add.dart index 143ce89..dde3011 100644 --- a/lib/apps/group_chat/add.dart +++ b/lib/apps/group_chat/add.dart @@ -49,7 +49,7 @@ class _GroupAddPageState extends State { FocusNode _createKeyFocus = FocusNode(); int _groupAddr = 0; - int _groupType = 0; + int _groupType = 1; bool _groupNeedAgree = false; bool _groupHasKey = true; bool _groupHasNeedAgree = true; @@ -60,31 +60,32 @@ class _GroupAddPageState extends State { bool _requestsLoadMore = true; // 0 => encrypted, 1 => common, 2 => open. - Widget _groupAddrWidget(String text, int value, ColorScheme color) { + Widget _groupAddrWidget(String text, int value, ColorScheme color, bool disabled) { return Row( children: [ Radio( value: value, groupValue: _groupAddr, - onChanged: (n) => setState(() { + onChanged: disabled ? null : (n) => setState(() { _groupAddr = n; }), ), _groupAddr == value ? Text(text, style: TextStyle(color: color.primary)) - : Text(text), + : (disabled ? Text(text, style: TextStyle(color: Color(0xFFADB0BB))) + : Text(text)), ] ); } // 0 => encrypted, 1 => common, 2 => open. - Widget _groupTypeWidget(String text, int value, ColorScheme color) { + Widget _groupTypeWidget(String text, int value, ColorScheme color, bool disabled) { return Row( children: [ Radio( value: value, groupValue: _groupType, - onChanged: (n) => setState(() { + onChanged: disabled ? null : (n) => setState(() { _groupType = n; if (n == 0) { _groupHasKey = true; @@ -101,7 +102,8 @@ class _GroupAddPageState extends State { ), _groupType == value ? Text(text, style: TextStyle(color: color.primary)) - : Text(text), + : (disabled ? Text(text, style: TextStyle(color: Color(0xFFADB0BB))) + : Text(text)), ] ); } @@ -337,8 +339,8 @@ class _GroupAddPageState extends State { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - _groupAddrWidget(lang.deviceRemote, 0, color), - _groupAddrWidget(lang.deviceLocal, 1, color), + _groupAddrWidget(lang.deviceRemote, 0, color, false), + _groupAddrWidget(lang.deviceLocal, 1, color, true), ] ) ), @@ -448,9 +450,9 @@ class _GroupAddPageState extends State { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - _groupTypeWidget(lang.groupTypeEncrypted, 0, color), - _groupTypeWidget(lang.groupTypePrivate, 1, color), - _groupTypeWidget(lang.groupTypeOpen, 2, color), + _groupTypeWidget(lang.groupTypeEncrypted, 0, color, true), + _groupTypeWidget(lang.groupTypePrivate, 1, color, false), + _groupTypeWidget(lang.groupTypeOpen, 2, color, false), ] ) ), diff --git a/lib/apps/group_chat/detail.dart b/lib/apps/group_chat/detail.dart index a302809..c207d74 100644 --- a/lib/apps/group_chat/detail.dart +++ b/lib/apps/group_chat/detail.dart @@ -81,7 +81,6 @@ class _GroupChatDetailState extends State { context.read().messageCreate(MessageType.String, textController.text); setState(() { textController.text = ''; - textFocus.requestFocus(); emojiShow = false; sendShow = false; @@ -100,7 +99,6 @@ class _GroupChatDetailState extends State { context.read().messageCreate(MessageType.Image, image); } setState(() { - textFocus.requestFocus(); emojiShow = false; sendShow = false; menuShow = false; @@ -114,7 +112,6 @@ class _GroupChatDetailState extends State { context.read().messageCreate(MessageType.File, file); } setState(() { - textFocus.requestFocus(); emojiShow = false; sendShow = false; menuShow = false; @@ -128,7 +125,6 @@ class _GroupChatDetailState extends State { context.read().messageCreate(MessageType.Record, raw); } setState(() { - textFocus.requestFocus(); emojiShow = false; sendShow = false; menuShow = false; @@ -141,7 +137,6 @@ class _GroupChatDetailState extends State { context.read().messageCreate(MessageType.Contact, "${id}"); } setState(() { - textFocus.requestFocus(); emojiShow = false; sendShow = false; menuShow = false; diff --git a/lib/apps/group_chat/list.dart b/lib/apps/group_chat/list.dart index 75ffb3b..585c905 100644 --- a/lib/apps/group_chat/list.dart +++ b/lib/apps/group_chat/list.dart @@ -29,7 +29,7 @@ class _GroupChatListState extends State { return Scaffold( appBar: AppBar( - title: Text(lang.groupChat), + title: Text(lang.groupChats), bottom: PreferredSize( child: Container(color: const Color(0x40ADB0BB), height: 1.0), preferredSize: Size.fromHeight(1.0) diff --git a/lib/l10n/localizations.dart b/lib/l10n/localizations.dart index 7891a15..3ccba48 100644 --- a/lib/l10n/localizations.dart +++ b/lib/l10n/localizations.dart @@ -50,6 +50,7 @@ abstract class AppLocalizations { String get info; String get contact; String get friend; + String get friends; String get logout; String get onlineWaiting; String get onlineActive; @@ -173,6 +174,7 @@ abstract class AppLocalizations { String get assistant; String get assistantBio; String get groupChat; + String get groupChats; String get groupChatAdd; String get groupChatIntro; String get groupChatId; diff --git a/lib/l10n/localizations_en.dart b/lib/l10n/localizations_en.dart index 6ad2525..cabd5c8 100644 --- a/lib/l10n/localizations_en.dart +++ b/lib/l10n/localizations_en.dart @@ -25,6 +25,8 @@ class AppLocalizationsEn extends AppLocalizations { @override String get friend => 'Friend'; @override + String get friends => 'Friends'; + @override String get logout => 'Logout'; @override String get onlineWaiting => 'Waiting...'; @@ -257,6 +259,8 @@ class AppLocalizationsEn extends AppLocalizations { @override String get groupChat => 'Group Chat'; @override + String get groupChats => 'Groups'; + @override String get groupChatAdd => 'Add Group Chat'; @override String get groupChatIntro => 'Multiple group chats'; diff --git a/lib/l10n/localizations_zh.dart b/lib/l10n/localizations_zh.dart index c31567a..db92bf3 100644 --- a/lib/l10n/localizations_zh.dart +++ b/lib/l10n/localizations_zh.dart @@ -25,6 +25,8 @@ class AppLocalizationsZh extends AppLocalizations { @override String get friend => '好友'; @override + String get friends => '好友'; + @override String get logout => '退出'; @override String get onlineWaiting => '连接中...'; @@ -149,7 +151,7 @@ class AppLocalizationsZh extends AppLocalizations { @override String get addService => '添加服务'; @override - String get services => '服务列表'; + String get services => '服务'; @override String get devices => '关联设备'; @override @@ -257,6 +259,8 @@ class AppLocalizationsZh extends AppLocalizations { @override String get groupChat => '群聊'; @override + String get groupChats => '群聊'; + @override String get groupChatAdd => '添加群聊'; @override String get groupChatIntro => '各种各样的群聊'; diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 227953f..468a0ab 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -34,6 +34,7 @@ import 'package:esse/apps/file/list.dart'; import 'package:esse/apps/service/list.dart'; import 'package:esse/apps/service/add.dart'; import 'package:esse/apps/assistant/page.dart'; +import 'package:esse/apps/group_chat/list.dart'; import 'package:esse/apps/group_chat/detail.dart'; import 'package:esse/apps/group_chat/provider.dart'; @@ -346,7 +347,7 @@ class DrawerWidget extends StatelessWidget { const Divider(height: 1.0, color: Color(0x40ADB0BB)), ListTile( leading: Icon(Icons.people_rounded, color: color.primary), - title: Text(lang.contact, textAlign: TextAlign.left, + title: Text(lang.friends, textAlign: TextAlign.left, style: TextStyle(fontSize: 16.0)), onTap: () { Navigator.pop(context); @@ -360,6 +361,21 @@ class DrawerWidget extends StatelessWidget { } }), + ListTile( + leading: Icon(Icons.groups_rounded, color: color.primary), + title: Text(lang.groupChats, textAlign: TextAlign.left, + style: TextStyle(fontSize: 16.0)), + onTap: () { + Navigator.pop(context); + final coreWidget = GroupChatList(); + if (isDesktop) { + Provider.of(context, listen: false).updateActivedWidget( + coreWidget + ); + } else { + Navigator.push(context, MaterialPageRoute(builder: (_) => coreWidget)); + } + }), ListTile( leading: Icon(Icons.grid_view_rounded, color: color.primary), title: Text(lang.services, textAlign: TextAlign.left,