From ccb89584e2256cff87a91b726098fccf413f9024 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 27 Nov 2022 12:24:21 +0300 Subject: [PATCH] chat structure issues. --- lib/classes/colors.dart | 1 + lib/classes/consts.dart | 12 +- lib/ui/chat/chat_bubble.dart | 56 ++++ lib/ui/chat/chat_detailed_screen.dart | 413 ++++++++++---------------- lib/ui/chat/chat_home.dart | 14 +- lib/ui/chat/chat_home_screen.dart | 52 +--- 6 files changed, 231 insertions(+), 317 deletions(-) diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index f99cc31..10681be 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -17,6 +17,7 @@ class MyColors { static const Color greyF7Color = Color(0xffF7F7F7); static const Color grey80Color = Color(0xff808080); static const Color grey70Color = Color(0xff707070); + static const Color grey7BColor = Color(0xff7B7B7B); static const Color greyACColor = Color(0xffACACAC); static const Color grey98Color = Color(0xff989898); static const Color lightGreyEFColor = Color(0xffEFEFEF); diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index ede22e3..4d6eca8 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - //static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; @@ -10,10 +10,12 @@ class ApiConsts { static String user = baseUrlServices + "api/User/"; static String cocRest = baseUrlServices + "COCWS.svc/REST/"; + // todo @aamir move api end point last repo to concerned method. + //Chat - static String chatServerBaseUrl = "https://apiderichat.hmg.com"; - static String chatServerBaseApiUrl = "https://apiderichat.hmg.com/api/"; - static String chatHubConnectionUrl = chatServerBaseUrl + "/ConnectionChatHub"; + static String chatServerBaseUrl = "https://apiderichat.hmg.com/"; + static String chatServerBaseApiUrl = chatServerBaseUrl + "api/"; + static String chatHubConnectionUrl = chatServerBaseUrl + "ConnectionChatHub"; static String chatSearchMember = "user/getUserWithStatusAndFavAsync/"; static String chatRecentUrl = "UserChatHistory/getchathistorybyuserid"; //For a Mem static String chatSingleUserHistoryUrl = "UserChatHistory/GetUserChatHistory"; diff --git a/lib/ui/chat/chat_bubble.dart b/lib/ui/chat/chat_bubble.dart index a7dd9b0..38c47ae 100644 --- a/lib/ui/chat/chat_bubble.dart +++ b/lib/ui/chat/chat_bubble.dart @@ -29,6 +29,8 @@ class ChatBubble extends StatelessWidget { @override Widget build(BuildContext context) { + return isCurrentUser ? currentUser(context) : receiptUser(context); + return Padding( // padding: EdgeInsets.zero, padding: EdgeInsets.only( @@ -148,4 +150,58 @@ class ChatBubble extends StatelessWidget { ), ); } + + Widget currentUser(context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (text).toText12(), + Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + dateTime.toText10(color: MyColors.grey41Color.withOpacity(.5)), + 7.width, + Icon( + isDelivered ? Icons.done_all : Icons.done_all, + color: isSeen ? MyColors.textMixColor : MyColors.grey9DColor, + size: 14, + ), + ], + ), + ), + ], + ).paddingOnly(top: 11, left: 13, right: 7, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3); + } + + Widget receiptUser(context) { + return Container( + padding: const EdgeInsets.only(top: 11, left: 13, right: 7, bottom: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + gradient: const LinearGradient( + transform: GradientRotation(.83), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (text).toText12(color: Colors.white), + Align( + alignment: Alignment.centerRight, + child: dateTime.toText10( + color: Colors.white.withOpacity(.71), + ), + ), + ], + ), + ).paddingOnly(right: MediaQuery.of(context).size.width * 0.3); + } } diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index a3cf2e9..00bb43b 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -1,18 +1,16 @@ import 'dart:async'; -import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/models/chat/call.dart'; +import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/ui/chat/call/chat_outgoing_call_screen.dart'; import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart'; import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; @@ -49,9 +47,7 @@ class _ChatDetailScreenState extends State { } } await Future.delayed( - const Duration( - milliseconds: 1000, - ), + const Duration(milliseconds: 1000), ); _rc.loadComplete(); } @@ -71,283 +67,172 @@ class _ChatDetailScreenState extends State { return Scaffold( backgroundColor: MyColors.backgroundColor, - appBar: AppBarWidget(context, - title: userDetails["targetUser"].userName.toString().replaceAll(".", " ").capitalizeFirstofEach, - showHomeButton: false, - image: userDetails["targetUser"].image, - actions: [ - IconButton( - onPressed: () { - makeCall( - callType: "AUDIO", - con: hubConnection, - ); - }, - icon: SvgPicture.asset( - "assets/icons/chat/call.svg", - width: 22, - height: 22, - ), - ), - IconButton( - onPressed: () { - makeCall( - callType: "VIDEO", - con: hubConnection, - ); - }, - icon: SvgPicture.asset( - "assets/icons/chat/video_call.svg", - width: 20, - height: 20, - ), - ), - 10.width, - ]), + appBar: AppBarWidget( + context, + title: userDetails["targetUser"].userName.toString().replaceAll(".", " ").capitalizeFirstofEach, + showHomeButton: false, + image: userDetails["targetUser"].image, + actions: [ + IconButton( + onPressed: () { + makeCall(callType: "AUDIO", con: hubConnection); + }, + icon: SvgPicture.asset("assets/icons/chat/call.svg", width: 22, height: 22), + ), + IconButton( + onPressed: () { + makeCall(callType: "VIDEO", con: hubConnection); + }, + icon: SvgPicture.asset("assets/icons/chat/video_call.svg", width: 20, height: 20), + ), + 10.width, + ], + ), body: Consumer( builder: (BuildContext context, ChatProviderModel m, Widget? child) { return (m.isLoading ? ChatHomeShimmer() : Column( children: [ - Expanded( - flex: 2, - child: SmartRefresher( - enablePullDown: false, - enablePullUp: true, - onLoading: () { - getMoreChat(); - }, - header: const MaterialClassicHeader( - color: MyColors.gradiantEndColor, - ), - controller: _rc, + SmartRefresher( + enablePullDown: false, + enablePullUp: true, + onLoading: () { + getMoreChat(); + }, + header: const MaterialClassicHeader( + color: MyColors.gradiantEndColor, + ), + controller: _rc, + reverse: true, + child: ListView.separated( + controller: m.scrollController, + shrinkWrap: true, + physics: const BouncingScrollPhysics(), reverse: true, - child: ListView.builder( - controller: m.scrollController, - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - reverse: true, - itemCount: m.userChatHistory.length, - padding: const EdgeInsets.only(top: 20), - itemBuilder: (BuildContext context, int i) { - return SwipeTo( - iconColor: MyColors.lightGreenColor, - child: ChatBubble( - text: m.userChatHistory[i].contant.toString(), - replyText: m.userChatHistory[i].userChatReplyResponse != null ? m.userChatHistory[i].userChatReplyResponse!.contant.toString() : "", - isSeen: m.userChatHistory[i].isSeen == true ? true : false, - isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false, - isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false, - dateTime: m.dateFormte(m.userChatHistory[i].createdDate!), - isReplied: m.userChatHistory[i].userChatReplyResponse != null ? true : false, - userName: AppState().chatDetails!.response!.userName == m.userChatHistory[i].currentUserName.toString() ? "You" : m.userChatHistory[i].currentUserName.toString(), - ), - onRightSwipe: () { - m.chatReply( - m.userChatHistory[i], - ); - }, - ); - }, - ), + itemCount: m.userChatHistory.length, + padding: const EdgeInsets.all(21), + separatorBuilder: (cxt, index) => 8.height, + itemBuilder: (BuildContext context, int i) { + return SwipeTo( + iconColor: MyColors.lightGreenColor, + child: ChatBubble( + text: m.userChatHistory[i].contant.toString(), + replyText: m.userChatHistory[i].userChatReplyResponse != null ? m.userChatHistory[i].userChatReplyResponse!.contant.toString() : "", + isSeen: m.userChatHistory[i].isSeen == true ? true : false, + isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false, + isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false, + dateTime: m.dateFormte(m.userChatHistory[i].createdDate!), + isReplied: m.userChatHistory[i].userChatReplyResponse != null ? true : false, + userName: AppState().chatDetails!.response!.userName == m.userChatHistory[i].currentUserName.toString() ? "You" : m.userChatHistory[i].currentUserName.toString(), + ), + onRightSwipe: () { + m.chatReply( + m.userChatHistory[i], + ); + }, + ); + }, ), - ), + ).expanded, if (m.isMsgReply) - Row( - children: [ - Container( - height: 80, - color: MyColors.textMixColor, - width: 6, - ), - Expanded( - child: Container( - height: 80, - color: MyColors.black.withOpacity(0.10), - child: ListTile( - title: (AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString() - ? "You" - : m.repliedMsg.first.currentUserName.toString().replaceAll(".", " ")) - .toText14(color: MyColors.lightGreenColor), - subtitle: (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12( - color: MyColors.white, - maxLine: 2, - ), - trailing: GestureDetector( - onTap: m.closeMe, - child: Container( - decoration: BoxDecoration( - color: MyColors.white.withOpacity(0.5), - borderRadius: const BorderRadius.all( - Radius.circular(20), - ), - ), - child: const Icon( - Icons.close, - size: 23, - color: MyColors.white, - ), - ), - ), + SizedBox( + height: 82, + child: Row( + children: [ + Container(height: 82, color: MyColors.textMixColor, width: 6), + Container( + color: MyColors.darkTextColor.withOpacity(0.10), + padding: const EdgeInsets.only(top: 11, left: 14, bottom: 14, right: 21), + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString() + ? "You" + : m.repliedMsg.first.currentUserName.toString().replaceAll(".", " ")) + .toText14(color: MyColors.lightGreenColor), + (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.grey71Color, maxLine: 2) + ], + ).expanded, + 12.width, + const Icon(Icons.cancel, size: 23, color: MyColors.grey7BColor).onPress(m.closeMe), + ], ), - ), - ), - ], + ).expanded, + ], + ), ), if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg") - Card( - margin: EdgeInsets.zero, - elevation: 0, - child: Padding( - padding: const EdgeInsets.only( - left: 20, - right: 20, - top: 20, - bottom: 0, - ), - child: Card( - margin: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(0), - ), - elevation: 0, - child: Container( - height: 200, - decoration: BoxDecoration( - image: DecorationImage( - image: FileImage( - m.selectedFile, + SizedBox(height: 200, width: double.infinity, child: Image.file(m.selectedFile, fit: BoxFit.cover)).paddingOnly(left: 21, right: 21, top: 21), + TextField( + controller: m.message, + decoration: InputDecoration( + hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(), + hintStyle: TextStyle(color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14), + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + contentPadding: EdgeInsets.only(left: m.sFileType.isNotEmpty ? 10 : 20, right: m.sFileType.isNotEmpty ? 0 : 5, top: 20, bottom: 20), + prefixIconConstraints: BoxConstraints(), + prefixIcon: m.sFileType.isNotEmpty ? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover) : null, + suffixIcon: SizedBox( + width: 96, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, // added line + children: [ + if (m.sFileType.isNotEmpty) + IconButton( + padding: EdgeInsets.zero, + alignment: Alignment.centerRight, + icon: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + decoration: const BoxDecoration( + color: MyColors.redA3Color, + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + ), + child: const Icon(Icons.close, size: 15, color: MyColors.white), + ), + ("Clear").toText11(color: MyColors.redA3Color).paddingOnly(left: 4), + ], ), - fit: BoxFit.cover, - ), - borderRadius: const BorderRadius.all( - Radius.circular(0), + onPressed: () async { + m.removeAttachment(); + }, ), - ), - child: const SizedBox( - width: double.infinity, - height: 200, - ), - ), - ), - ), - ), - Card( - margin: EdgeInsets.zero, - child: TextField( - controller: m.message, - decoration: InputDecoration( - hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(), - hintStyle: TextStyle( - color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, - fontSize: 14, - ), - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - errorBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: EdgeInsets.only( - left: m.sFileType.isNotEmpty ? 10 : 20, - right: m.sFileType.isNotEmpty ? 0 : 5, - top: 20, - bottom: 20, - ), - prefixIcon: m.sFileType.isNotEmpty - ? Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - m.getType(m.sFileType), - height: 30, - width: 25, - alignment: Alignment.center, - fit: BoxFit.cover, - ).paddingOnly(left: 20), - ], - ) - : null, - suffixIcon: SizedBox( - width: 96, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, // added line - children: [ - if (m.sFileType.isNotEmpty) - IconButton( + if (m.sFileType.isEmpty) + RotationTransition( + turns: const AlwaysStoppedAnimation(45 / 360), + child: IconButton( padding: EdgeInsets.zero, - alignment: Alignment.centerRight, - icon: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - decoration: const BoxDecoration( - color: MyColors.redA3Color, - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - ), - child: const Icon( - Icons.close, - size: 15, - color: MyColors.white, - ), - ), - ("Clear") - .toText11( - color: MyColors.redA3Color, - ) - .paddingOnly( - left: 4, - ), - ], - ), + alignment: Alignment.topRight, + icon: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor), onPressed: () async { - m.removeAttachment(); + m.selectImageToUpload(context); }, ), - if (m.sFileType.isEmpty) - RotationTransition( - turns: const AlwaysStoppedAnimation(45 / 360), - child: IconButton( - padding: EdgeInsets.zero, - alignment: Alignment.topRight, - icon: const Icon( - Icons.attach_file_rounded, - size: 26, - color: MyColors.grey3AColor, - ), - onPressed: () async { - m.selectImageToUpload(context); - }, - ), - ), - IconButton( - alignment: Alignment.centerRight, - padding: EdgeInsets.zero, - icon: SvgPicture.asset( - "assets/icons/chat/chat_send_icon.svg", - height: 26, - width: 26, - ), - onPressed: () { - m.sendChatMessage( - userDetails["targetUser"].id, - userDetails["targetUser"].userName, - context, - ); - }, - ) - ], - ), - ).paddingOnly( - right: 20, + ), + IconButton( + alignment: Alignment.centerRight, + padding: EdgeInsets.zero, + icon: SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26), + onPressed: () { + m.sendChatMessage(userDetails["targetUser"].id, userDetails["targetUser"].userName, context); + }, + ) + ], ), - ), + ).paddingOnly(right: 20), ), ), ], diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index 3ad9b12..3bf8cda 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -1,19 +1,13 @@ -import 'dart:convert'; - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; -import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; -import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/ui/chat/chat_home_screen.dart'; import 'package:mohem_flutter_app/ui/chat/favorite_users_screen.dart'; -import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/items_for_sale.dart'; -import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; @@ -45,11 +39,7 @@ class _ChatHomeState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: MyColors.white, - appBar: AppBarWidget( - context, - title: LocaleKeys.chat.tr(), - showHomeButton: true, - ), + appBar: AppBarWidget(context, title: LocaleKeys.chat.tr(), showHomeButton: true), body: Column( children: [ Container( diff --git a/lib/ui/chat/chat_home_screen.dart b/lib/ui/chat/chat_home_screen.dart index a6f91b8..db18166 100644 --- a/lib/ui/chat/chat_home_screen.dart +++ b/lib/ui/chat/chat_home_screen.dart @@ -2,13 +2,13 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; @@ -51,50 +51,30 @@ class _ChatHomeScreenState extends State { physics: const AlwaysScrollableScrollPhysics(), children: [ Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, - horizontal: 20, - ), + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20), child: TextField( controller: m.search, + style: const TextStyle(color: MyColors.darkTextColor, fontWeight: FontWeight.w500, fontSize: 12), onChanged: (String val) { m.filter(val); }, decoration: InputDecoration( - 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, - ), + border: fieldBorder(radius: 5, color: 0xFFE5E5E5), + focusedBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5), + enabledBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5), + contentPadding: const EdgeInsets.all(11), hintText: LocaleKeys.searchfromchat.tr(), - hintStyle: const TextStyle( - color: MyColors.lightTextColor, - fontStyle: FontStyle.italic, - ), + hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic, fontWeight: FontWeight.w500, fontSize: 12), filled: true, - fillColor: const Color( - 0xFFF7F7F7, - ), + fillColor: const Color(0xFFF7F7F7), + suffixIconConstraints: const BoxConstraints(), suffixIcon: m.search.text.isNotEmpty ? IconButton( + constraints: const BoxConstraints(), onPressed: () { m.clearSelections(); }, - icon: const Icon( - Icons.clear, - size: 22, - ), + icon: const Icon(Icons.clear, size: 22), color: MyColors.redA3Color, ) : null, @@ -103,15 +83,15 @@ class _ChatHomeScreenState extends State { ), if (m.searchedChats != null) ListView.separated( - itemCount: m.searchedChats!.length, - padding: const EdgeInsets.only( - bottom: 80, - ), + itemCount: m.searchedChats!.length + 20, + padding: const EdgeInsets.only(bottom: 80), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (BuildContext context, int index) { + index = 0; return SizedBox( height: 55, + // todo @aamir, remove list tile, make a custom ui instead child: ListTile( leading: Stack( children: [