diff --git a/lib/ui/chat/call/chat_outgoing_call_screen.dart b/lib/ui/chat/call/chat_outgoing_call_screen.dart index b5a47a6..25bc05d 100644 --- a/lib/ui/chat/call/chat_outgoing_call_screen.dart +++ b/lib/ui/chat/call/chat_outgoing_call_screen.dart @@ -82,7 +82,7 @@ class _OutGoingCallState extends State with SingleTickerProviderSt Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Container( margin: const EdgeInsets.all(21.0), child: Container( @@ -102,7 +102,7 @@ class _OutGoingCallState extends State with SingleTickerProviderSt fit: BoxFit.cover, ), 10.height, - Text( + const Text( "Aamir Saleem Ahmad", style: TextStyle( fontSize: 21, @@ -112,7 +112,7 @@ class _OutGoingCallState extends State with SingleTickerProviderSt height: 23 / 12, ), ), - Text( + const Text( "Ringing...", style: TextStyle( fontSize: 16, @@ -124,7 +124,7 @@ class _OutGoingCallState extends State with SingleTickerProviderSt height: 23 / 24, ), ), - SizedBox( + const SizedBox( height: 2, ), ], @@ -177,96 +177,54 @@ class _OutGoingCallState extends State with SingleTickerProviderSt mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ if (widget.isVideoCall!) - RotationTransition( - turns: Tween( - begin: 0.0, - end: -.1, - ) - .chain( - CurveTween( - curve: Curves.elasticIn, - ), - ) - .animate( - _animationController!, - ), - child: RawMaterialButton( - onPressed: () { - _camOff(); - }, - elevation: 2.0, - fillColor: isCamOff ? MyColors.green2DColor : Colors.grey, - padding: const EdgeInsets.all( - 15.0, - ), - shape: const CircleBorder(), - child: Icon( - isCamOff ? Icons.videocam_off : Icons.videocam, - color: MyColors.white, - size: 35.0, - ), + RawMaterialButton( + onPressed: () { + _camOff(); + }, + elevation: 2.0, + fillColor: isCamOff ? MyColors.green2DColor : Colors.grey, + padding: const EdgeInsets.all( + 15.0, ), - ) - else - RotationTransition( - turns: Tween( - begin: 0.0, - end: -.1, - ) - .chain( - CurveTween( - curve: Curves.elasticIn, - ), - ) - .animate( - _animationController!, - ), - child: RawMaterialButton( - onPressed: () { - _loudOn(); - }, - elevation: 2.0, - fillColor: isLoudSpeaker ? MyColors.green2DColor : Colors.grey, - padding: const EdgeInsets.all( - 15.0, - ), - shape: const CircleBorder(), - child: const Icon( - Icons.volume_up, - color: MyColors.white, - size: 35.0, - ), + shape: const CircleBorder(), + child: Icon( + isCamOff ? Icons.videocam_off : Icons.videocam, + color: MyColors.white, + size: 35.0, ), - ), - RotationTransition( - turns: Tween( - begin: 0.0, - end: -.1, ) - .chain( - CurveTween( - curve: Curves.elasticIn, - ), - ) - .animate( - _animationController!, - ), - child: RawMaterialButton( + else + RawMaterialButton( onPressed: () { - _micOff(); + _loudOn(); }, elevation: 2.0, - fillColor: isMicOff ? MyColors.green2DColor : Colors.grey, + fillColor: isLoudSpeaker ? MyColors.green2DColor : Colors.grey, padding: const EdgeInsets.all( 15.0, ), shape: const CircleBorder(), - child: Icon( - isMicOff ? Icons.mic_off : Icons.mic, + child: const Icon( + Icons.volume_up, color: MyColors.white, size: 35.0, ), ), + RawMaterialButton( + onPressed: () { + _micOff(); + }, + elevation: 2.0, + fillColor: isMicOff ? MyColors.green2DColor : Colors.grey, + padding: const EdgeInsets.all( + 15.0, + ), + shape: const CircleBorder(), + child: Icon( + isMicOff ? Icons.mic_off : Icons.mic, + color: MyColors.white, + size: 35.0, + ), ), RawMaterialButton( onPressed: () { diff --git a/lib/ui/chat/chat_bubble.dart b/lib/ui/chat/chat_bubble.dart index 6dcd6d2..1696a49 100644 --- a/lib/ui/chat/chat_bubble.dart +++ b/lib/ui/chat/chat_bubble.dart @@ -30,7 +30,11 @@ class ChatBubble extends StatelessWidget { Widget build(BuildContext context) { return Padding( // padding: EdgeInsets.zero, - padding: EdgeInsets.only(left: isCurrentUser ? 110 : 20, right: isCurrentUser ? 20 : 110, bottom: 9), + padding: EdgeInsets.only( + left: isCurrentUser ? 110 : 20, + right: isCurrentUser ? 20 : 110, + bottom: 9, + ), child: Align( alignment: isCurrentUser ? Alignment.centerRight : Alignment.centerLeft, @@ -40,7 +44,9 @@ class ChatBubble extends StatelessWidget { gradient: isCurrentUser ? null : const LinearGradient( - transform: GradientRotation(.46), + transform: GradientRotation( + .46, + ), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ @@ -48,21 +54,33 @@ class ChatBubble extends StatelessWidget { MyColors.gradiantStartColor, ], ), - borderRadius: BorderRadius.circular(10), + borderRadius: BorderRadius.circular( + 10, + ), ), child: Padding( - padding: EdgeInsets.only(top: isReplied ? 8 : 5, right: 8, left: 8, bottom: 5), + padding: EdgeInsets.only( + top: isReplied ? 8 : 5, + right: 8, + left: 8, + bottom: 5, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ if (isReplied) ClipRRect( - borderRadius: BorderRadius.circular(5.0), + borderRadius: BorderRadius.circular( + 5.0, + ), child: Container( decoration: BoxDecoration( border: Border( - left: BorderSide(width: 6, color: isCurrentUser ? MyColors.gradiantStartColor : MyColors.white), + left: BorderSide( + width: 6, + color: isCurrentUser ? MyColors.gradiantStartColor : MyColors.white, + ), ), color: isCurrentUser ? MyColors.black.withOpacity(0.10) : MyColors.black.withOpacity(0.30), ), @@ -72,10 +90,29 @@ class ChatBubble extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5), + (userName) + .toText12( + color: MyColors.gradiantStartColor, + isBold: false, + ) + .paddingOnly( + right: 5, + top: 5, + bottom: 0, + left: 5, + ), replyText - .toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4) - .paddingOnly(right: 5, top: 5, bottom: 8, left: 5), + .toText10( + color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), + isBold: false, + maxlines: 4, + ) + .paddingOnly( + right: 5, + top: 5, + bottom: 8, + left: 5, + ), ], ), ), @@ -84,12 +121,16 @@ class ChatBubble extends StatelessWidget { ), ), if (isReplied) 8.height, - text.toText12(color: isCurrentUser ? MyColors.grey57Color : MyColors.white), + text.toText12( + color: isCurrentUser ? MyColors.grey57Color : MyColors.white, + ), Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, - children: [ - dateTime.toText12(color: isCurrentUser ? MyColors.grey41Color.withOpacity(.5) : MyColors.white.withOpacity(0.7),), + children: [ + dateTime.toText12( + color: isCurrentUser ? MyColors.grey41Color.withOpacity(.5) : MyColors.white.withOpacity(0.7), + ), if (isCurrentUser) 5.width, // if (isCurrentUser) // Icon( diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index 2c8b2d8..347c573 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -132,7 +132,9 @@ class _ChatDetailScreenState extends State { userName: AppState().chatDetails!.response!.userName == m.userChatHistory[i].currentUserName.toString() ? "You" : m.userChatHistory[i].currentUserName.toString(), ), onRightSwipe: () { - m.chatReply(m.userChatHistory[i]); + m.chatReply( + m.userChatHistory[i], + ); }, ); }, @@ -156,7 +158,10 @@ class _ChatDetailScreenState extends State { ? "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), + subtitle: (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12( + color: MyColors.white, + maxLine: 2, + ), trailing: GestureDetector( onTap: m.closeMe, child: Container( @@ -183,7 +188,12 @@ class _ChatDetailScreenState extends State { margin: EdgeInsets.zero, elevation: 0, child: Padding( - padding: const EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 0), + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + bottom: 0, + ), child: Card( margin: EdgeInsets.zero, shape: RoundedRectangleBorder( @@ -217,13 +227,21 @@ class _ChatDetailScreenState extends State { 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), + 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), + 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, @@ -267,7 +285,13 @@ class _ChatDetailScreenState extends State { color: MyColors.white, ), ), - ("Clear").toText11(color: MyColors.redA3Color).paddingOnly(left: 4), + ("Clear") + .toText11( + color: MyColors.redA3Color, + ) + .paddingOnly( + left: 4, + ), ], ), onPressed: () async { @@ -299,12 +323,18 @@ class _ChatDetailScreenState extends State { width: 26, ), onPressed: () { - m.sendChatMessage(userDetails["targetUser"].id, userDetails["targetUser"].userName, context); + m.sendChatMessage( + userDetails["targetUser"].id, + userDetails["targetUser"].userName, + context, + ); }, ) ], ), - ).paddingOnly(right: 20), + ).paddingOnly( + right: 20, + ), ), ), ), diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index ed6b155..9884d59 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -34,11 +34,8 @@ class _ChatHomeState extends State { // TODO: implement initState super.initState(); data = Provider.of(context, listen: false); - data.getUserAutoLoginToken().then((value) { + data.getUserAutoLoginToken().then((Object? value) { data.getUserRecentChats(); - // var datae = [int.parse(AppState().memberInformationList!.eMPLOYEENUMBER.toString())]; - - // data.hubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [int.parse(AppState().memberInformationList!.eMPLOYEENUMBER.toString())]); }); } @@ -73,14 +70,17 @@ class _ChatHomeState extends State { transform: GradientRotation(.83), begin: Alignment.topRight, end: Alignment.bottomLeft, - colors: [ + colors: [ MyColors.gradiantEndColor, MyColors.gradiantStartColor, ], ), ), child: Row( - children: [myTab(LocaleKeys.mychats.tr(), 0), myTab(LocaleKeys.favorite.tr(), 1)], + children: [ + myTab(LocaleKeys.mychats.tr(), 0), + myTab(LocaleKeys.favorite.tr(), 1), + ], ), ), PageView( @@ -91,7 +91,10 @@ class _ChatHomeState extends State { tabIndex = pageIndex; }); }, - children: [ChatHomeScreen(), ChatFavoriteUsersScreen()], + children: [ + ChatHomeScreen(), + ChatFavoriteUsersScreen(), + ], ).expanded, ], ), @@ -104,7 +107,10 @@ class _ChatHomeState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - title.toText12(color: isSelected ? MyColors.white : MyColors.white.withOpacity(.74), isCenter: true), + title.toText12( + color: isSelected ? MyColors.white : MyColors.white.withOpacity(.74), + isCenter: true, + ), 4.height, Container( height: 8, diff --git a/lib/ui/chat/chat_home_screen.dart b/lib/ui/chat/chat_home_screen.dart index a22c7e0..05623f7 100644 --- a/lib/ui/chat/chat_home_screen.dart +++ b/lib/ui/chat/chat_home_screen.dart @@ -40,21 +40,41 @@ 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, 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.symmetric( + horizontal: 15, + vertical: 10, + ), hintText: LocaleKeys.searchfromchat.tr(), - hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic), + hintStyle: const TextStyle( + color: MyColors.lightTextColor, + fontStyle: FontStyle.italic, + ), filled: true, - fillColor: const Color(0xFFF7F7F7), + fillColor: const Color( + 0xFFF7F7F7, + ), suffixIcon: m.search.text.isNotEmpty ? IconButton( onPressed: () { @@ -73,7 +93,9 @@ class _ChatHomeScreenState extends State { if (m.searchedChats != null) ListView.separated( itemCount: m.searchedChats!.length, - padding: const EdgeInsets.only(bottom: 80), + padding: const EdgeInsets.only( + bottom: 80, + ), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (BuildContext context, int index) { @@ -136,15 +158,26 @@ class _ChatHomeScreenState extends State { child: IconButton( alignment: Alignment.centerRight, padding: EdgeInsets.zero, - icon: Icon(m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp), + icon: Icon( + m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp, + ), color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color, onPressed: () { if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) { - m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); + m.favoriteUser( + userID: AppState().chatDetails!.response!.id!, + targetUserID: m.searchedChats![index].id!, + ); } else if (m.searchedChats![index].isFav == true) { - m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); + m.unFavoriteUser( + userID: AppState().chatDetails!.response!.id!, + targetUserID: m.searchedChats![index].id!, + ); } else { - m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); + m.favoriteUser( + userID: AppState().chatDetails!.response!.id!, + targetUserID: m.searchedChats![index].id!, + ); } }, ), @@ -167,9 +200,14 @@ class _ChatHomeScreenState extends State { ); }, separatorBuilder: (BuildContext context, int index) => const Padding( - padding: EdgeInsets.only(right: 10, left: 70), + padding: EdgeInsets.only( + right: 10, + left: 70, + ), child: Divider( - color: Color(0xFFE5E5E5), + color: Color( + 0xFFE5E5E5, + ), ), ), ), @@ -217,9 +255,13 @@ class _ChatHomeScreenState extends State { OutlineInputBorder fieldBorder({required double radius, required int color}) { return OutlineInputBorder( - borderRadius: BorderRadius.circular(radius), + borderRadius: BorderRadius.circular( + radius, + ), borderSide: BorderSide( - color: Color(color), + color: Color( + color, + ), ), ); } diff --git a/lib/ui/chat/favorite_users_screen.dart b/lib/ui/chat/favorite_users_screen.dart index fd118de..7ef0f84 100644 --- a/lib/ui/chat/favorite_users_screen.dart +++ b/lib/ui/chat/favorite_users_screen.dart @@ -34,7 +34,7 @@ class ChatFavoriteUsersScreen extends StatelessWidget { height: 55, child: ListTile( leading: Stack( - children: [ + children: [ SvgPicture.asset( "assets/images/user.svg", height: 48, @@ -56,14 +56,22 @@ class ChatFavoriteUsersScreen extends StatelessWidget { ) ], ), - title: (m.favUsersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor), + title: (m.favUsersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14( + color: MyColors.darkTextColor, + ), trailing: IconButton( alignment: Alignment.centerRight, padding: EdgeInsets.zero, - icon: Icon(m.favUsersList![index].isFav! ? Icons.star : Icons.star_border), + icon: Icon( + m.favUsersList![index].isFav! ? Icons.star : Icons.star_border, + ), color: m.favUsersList![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color, onPressed: () { - if (m.favUsersList![index].isFav!) m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.favUsersList![index].id!); + if (m.favUsersList![index].isFav!) + m.unFavoriteUser( + userID: AppState().chatDetails!.response!.id!, + targetUserID: m.favUsersList![index].id!, + ); }, ), minVerticalPadding: 0, @@ -82,7 +90,10 @@ class ChatFavoriteUsersScreen extends StatelessWidget { ); }, separatorBuilder: (BuildContext context, int index) => const Padding( - padding: EdgeInsets.only(right: 10, left: 70), + padding: EdgeInsets.only( + right: 10, + left: 70, + ), child: Divider( color: Color( 0xFFE5E5E5, diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 45eea24..130c75b 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -13,6 +13,7 @@ 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/offers_and_discounts/get_offers_list.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; @@ -479,9 +480,6 @@ class _DashboardScreenState extends State { ).paddingAll(4), Consumer( builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) { - // if (data.chatUConvCounter == 0) { - // return const SizedBox(); - // } return Positioned( right: 0, top: 0, @@ -515,7 +513,9 @@ class _DashboardScreenState extends State { } else if (index == 3) { Navigator.pushNamed(context, AppRoutes.itemsForSale); } else if (index == 4) { - Navigator.pushNamed(context, AppRoutes.chat); + Navigator.pushNamed(context, AppRoutes.chat).then((Object? value) { + data.fetchChatCounts(); + }); } }, ),