diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index bdec4f0..000e111 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -499,7 +499,7 @@ "resend": "إعادة إرسال", "codeExpire": "انتهت صلاحية رمز التحقق", "typeheretoreply": "اكتب هنا للرد", - "favorite" : "مفضل", + "favorite" : "أُفضله", "searchfromchat": "البحث من الدردشة" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 1cd1a33..c8b8322 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -499,7 +499,7 @@ "codeExpire": "The verification code has been expired", "allQuestionsCorrect": "You have answered all questions correct", "typeheretoreply": "Type here to reply", - "favorite" : "Favorite", + "favorite" : "My Favorite", "searchfromchat": "Search from chat" } \ No newline at end of file diff --git a/lib/api/chat/chat_provider_model.dart b/lib/api/chat/chat_provider_model.dart index 3cfee4f..3498a17 100644 --- a/lib/api/chat/chat_provider_model.dart +++ b/lib/api/chat/chat_provider_model.dart @@ -23,6 +23,7 @@ import 'package:uuid/uuid.dart'; class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { ScrollController scrollController = ScrollController(); TextEditingController message = TextEditingController(); + TextEditingController search = TextEditingController(); List userChatHistory = []; List? pChatHistory, searchedChats; late HubConnection hubConnection; @@ -582,12 +583,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void clearSelections() { + searchedChats = pChatHistory; + search.clear(); isChatScreenActive = false; paginationVal = 0; message.text = ''; isFileSelected = false; repliedMsg = []; sFileType = ""; + notifyListeners(); } void scrollListener() { diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 49dac5c..3d35ccc 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -515,7 +515,7 @@ class CodegenLoader extends AssetLoader{ "resend": "إعادة إرسال", "codeExpire": "انتهت صلاحية رمز التحقق", "typeheretoreply": "اكتب هنا للرد", - "favorite": "مفضل", + "favorite": "أُفضله", "searchfromchat": "البحث من الدردشة" }; static const Map en_US = { @@ -1019,7 +1019,7 @@ static const Map en_US = { "codeExpire": "The verification code has been expired", "allQuestionsCorrect": "You have answered all questions correct", "typeheretoreply": "Type here to reply", - "favorite": "Favorite", + "favorite": "My Favorite", "searchfromchat": "Search from chat" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; diff --git a/lib/ui/chat/chat_home_screen.dart b/lib/ui/chat/chat_home_screen.dart index ce866f8..f66f3d5 100644 --- a/lib/ui/chat/chat_home_screen.dart +++ b/lib/ui/chat/chat_home_screen.dart @@ -32,28 +32,14 @@ class ChatHomeScreen extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20), child: TextField( + controller: m.search, onChanged: (String val) { m.filter(val); }, decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(5), - borderSide: const BorderSide( - color: Color(0xFFE5E5E5), - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(5), - borderSide: const BorderSide( - color: Color(0xFFE5E5E5), - ), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(5), - borderSide: const BorderSide( - color: Color(0xFFE5E5E5), - ), - ), + border: fieldBorder(radius: 5, color: 0xFFE5E5E5), + focusedBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5), + enabledBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5), contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), hintText: LocaleKeys.searchfromchat.tr(), hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic), @@ -73,7 +59,7 @@ class ChatHomeScreen extends StatelessWidget { height: 55, child: ListTile( leading: Stack( - children: [ + children: [ SvgPicture.asset( "assets/images/user.svg", height: 48, @@ -144,12 +130,12 @@ class ChatHomeScreen extends StatelessWidget { Navigator.pushNamed( context, AppRoutes.chatDetailed, - arguments: {"targetUser": m.searchedChats![index], "isNewChat" : false}, + arguments: {"targetUser": m.searchedChats![index], "isNewChat": false}, ).then((Object? value) { m.clearSelections(); + m.notifyListeners(); }); }, - onLongPress: () {}, ), ); }, @@ -201,4 +187,13 @@ class ChatHomeScreen extends StatelessWidget { ), ); } + + OutlineInputBorder fieldBorder({required double radius, required int color}) { + return OutlineInputBorder( + borderRadius: BorderRadius.circular(radius), + borderSide: BorderSide( + color: Color(color), + ), + ); + } }