group chat started
							parent
							
								
									b227f11c7b
								
							
						
					
					
						commit
						9cb71b525e
					
				| @ -0,0 +1,56 @@ | ||||
| <?xml version="1.0" encoding="iso-8859-1"?> | ||||
| <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools --> | ||||
| <svg fill="#000000" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  | ||||
| 	 viewBox="0 0 392.601 392.601" xml:space="preserve"> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M117.659,132.85c-29.479,0-53.463,23.984-53.463,53.463s23.984,53.463,53.463,53.463 | ||||
| 			c29.543,0,53.463-23.984,53.463-53.463S147.138,132.85,117.659,132.85z M117.659,217.989c-17.455,0-31.677-14.222-31.677-31.677 | ||||
| 			s14.222-31.677,31.677-31.677s31.677,14.222,31.677,31.677S135.114,217.989,117.659,217.989z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M301.32,192.842c-23.531,0-42.731,19.2-42.731,42.731c0,23.596,19.135,42.731,42.731,42.731 | ||||
| 			c23.596,0,42.731-19.135,42.731-42.731C344.051,211.977,324.916,192.842,301.32,192.842z M301.32,256.518 | ||||
| 			c-11.507,0-20.945-9.374-20.945-20.945s9.438-20.945,20.945-20.945c11.572,0,20.945,9.374,20.945,20.945 | ||||
| 			C322.265,247.08,312.891,256.518,301.32,256.518z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M301.32,292.591c-32.194,0-60.832,17.325-76.994,43.119c-18.554-40.792-59.604-69.495-106.731-69.495 | ||||
| 			c-63.547,0-116.234,51.717-117.592,115.2c-0.065,2.909,1.099,5.818,3.103,7.887c2.069,2.069,4.848,3.232,7.822,3.232h370.166 | ||||
| 			c2.909,0,5.689-1.164,7.822-3.232c2.133-2.069,3.168-4.978,3.103-7.887C390.984,332.478,350.257,292.591,301.32,292.591z | ||||
| 			 M22.758,370.813c6.465-46.545,46.998-82.683,94.901-82.683c47.903,0,88.372,36.137,94.901,82.683H22.758z M233.57,370.813 | ||||
| 			c6.012-31.935,34.327-56.307,67.685-56.307s61.737,24.436,67.685,56.307H233.57z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M274.427,0.066c-65.164,0-118.174,36.913-118.174,82.36c0,22.109,12.541,43.184,34.844,58.505v44.865 | ||||
| 			c0,3.685,1.875,7.111,4.913,9.115c2.78,1.875,7.24,2.069,10.343,0.84l70.4-31.095c64.065-0.776,115.846-37.43,115.846-82.23 | ||||
| 			C392.601,36.979,339.59,0.066,274.427,0.066z M274.427,142.87c-1.552,0-3.038,0.323-4.396,0.905l-57.212,25.277v-34.069 | ||||
| 			c0-3.814-2.004-7.37-5.236-9.244c-18.747-11.507-29.608-27.281-29.608-43.378c0.065-32.776,44.218-60.509,96.452-60.509 | ||||
| 			s96.388,27.733,96.388,60.509C370.815,115.201,326.661,142.87,274.427,142.87z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M219.671,69.238h-5.107c-6.012,0-10.925,4.849-10.925,10.925c0.065,6.077,4.913,10.925,10.925,10.925h5.107 | ||||
| 			c6.012,0,10.925-4.849,10.925-10.925C230.597,74.151,225.748,69.238,219.671,69.238z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M276.948,69.238h-5.107c-6.012,0-10.925,4.849-10.925,10.925c0,6.077,4.978,10.925,10.925,10.925h5.107 | ||||
| 			c6.012,0,10.925-4.849,10.925-10.925C287.873,74.151,283.025,69.238,276.948,69.238z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| <g> | ||||
| 	<g> | ||||
| 		<path d="M334.289,69.238h-5.107c-6.012,0-10.925,4.849-10.925,10.925c0,6.077,4.913,10.925,10.925,10.925h5.107 | ||||
| 			c6.012,0,10.925-4.849,10.925-10.925C345.215,74.151,340.366,69.238,334.289,69.238z"/> | ||||
| 	</g> | ||||
| </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 2.9 KiB | 
| @ -0,0 +1,260 @@ | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| class GetUserGroups { | ||||
|   List<Response>? response; | ||||
|   Null? errorResponses; | ||||
| 
 | ||||
|   GetUserGroups({this.response, this.errorResponses}); | ||||
|   factory GetUserGroups.fromRawJson(String str) => GetUserGroups.fromJson(json.decode(str)); | ||||
| 
 | ||||
|   String toRawJson() => json.encode(toJson()); | ||||
|   GetUserGroups.fromJson(Map<String, dynamic> json) { | ||||
|     if (json['response'] != null) { | ||||
|       response = <Response>[]; | ||||
|       json['response'].forEach((v) { | ||||
|         response!.add(new Response.fromJson(v)); | ||||
|       }); | ||||
|     } | ||||
|     errorResponses = json['errorResponses']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|      Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     if (this.response != null) { | ||||
|       data['response'] = this.response!.map((v) => v.toJson()).toList(); | ||||
|     } | ||||
|     data['errorResponses'] = this.errorResponses; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class Response { | ||||
|   int? groupId; | ||||
|   String? groupName; | ||||
|   Null? groupIcon; | ||||
|   bool? isDeleted; | ||||
|   bool? isAdmin; | ||||
|   bool? canVideoC; | ||||
|   bool? canAudioC; | ||||
|   bool? canShareS; | ||||
|   bool? canAttach; | ||||
|   bool? canArchive; | ||||
|   bool? isMeeting; | ||||
|   Null? meetingTime; | ||||
|   Null? extUserLink; | ||||
|   int? callStatus; | ||||
|   int? groupUnreadMessageCount; | ||||
|   AdminUser? adminUser; | ||||
|   List<GroupUserList>? groupUserList; | ||||
| 
 | ||||
|   Response( | ||||
|       {this.groupId, | ||||
|         this.groupName, | ||||
|         this.groupIcon, | ||||
|         this.isDeleted, | ||||
|         this.isAdmin, | ||||
|         this.canVideoC, | ||||
|         this.canAudioC, | ||||
|         this.canShareS, | ||||
|         this.canAttach, | ||||
|         this.canArchive, | ||||
|         this.isMeeting, | ||||
|         this.meetingTime, | ||||
|         this.extUserLink, | ||||
|         this.callStatus, | ||||
|         this.groupUnreadMessageCount, | ||||
|         this.adminUser, | ||||
|         this.groupUserList}); | ||||
| 
 | ||||
|   Response.fromJson(Map<String, dynamic> json) { | ||||
|     groupId = json['groupId']; | ||||
|     groupName = json['groupName']; | ||||
|     groupIcon = json['groupIcon']; | ||||
|     isDeleted = json['isDeleted']; | ||||
|     isAdmin = json['isAdmin']; | ||||
|     canVideoC = json['canVideoC']; | ||||
|     canAudioC = json['canAudioC']; | ||||
|     canShareS = json['canShareS']; | ||||
|     canAttach = json['canAttach']; | ||||
|     canArchive = json['canArchive']; | ||||
|     isMeeting = json['isMeeting']; | ||||
|     meetingTime = json['meetingTime']; | ||||
|     extUserLink = json['extUserLink']; | ||||
|     callStatus = json['callStatus']; | ||||
|     groupUnreadMessageCount = json['groupUnreadMessageCount']; | ||||
|     adminUser = json['adminUser'] != null | ||||
|         ? new AdminUser.fromJson(json['adminUser']) | ||||
|         : null; | ||||
|     if (json['groupUserList'] != null) { | ||||
|       groupUserList = <GroupUserList>[]; | ||||
|       json['groupUserList'].forEach((v) { | ||||
|         groupUserList!.add(new GroupUserList.fromJson(v)); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|      Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['groupId'] = this.groupId; | ||||
|     data['groupName'] = this.groupName; | ||||
|     data['groupIcon'] = this.groupIcon; | ||||
|     data['isDeleted'] = this.isDeleted; | ||||
|     data['isAdmin'] = this.isAdmin; | ||||
|     data['canVideoC'] = this.canVideoC; | ||||
|     data['canAudioC'] = this.canAudioC; | ||||
|     data['canShareS'] = this.canShareS; | ||||
|     data['canAttach'] = this.canAttach; | ||||
|     data['canArchive'] = this.canArchive; | ||||
|     data['isMeeting'] = this.isMeeting; | ||||
|     data['meetingTime'] = this.meetingTime; | ||||
|     data['extUserLink'] = this.extUserLink; | ||||
|     data['callStatus'] = this.callStatus; | ||||
|     data['groupUnreadMessageCount'] = this.groupUnreadMessageCount; | ||||
|     if (this.adminUser != null) { | ||||
|       data['adminUser'] = this.adminUser!.toJson(); | ||||
|     } | ||||
|     if (this.groupUserList != null) { | ||||
|       data['groupUserList'] = | ||||
|           this.groupUserList!.map((v) => v.toJson()).toList(); | ||||
|     } | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class AdminUser { | ||||
|   int? id; | ||||
|   String? userName; | ||||
|   String? email; | ||||
|   Null? phone; | ||||
|   String? title; | ||||
|   int? userStatus; | ||||
|   Null? image; | ||||
|   int? unreadMessageCount; | ||||
|   Null? userAction; | ||||
|   bool? isPin; | ||||
|   bool? isFav; | ||||
|   bool? isAdmin; | ||||
|   Null? rKey; | ||||
|   int? totalCount; | ||||
| 
 | ||||
|   AdminUser( | ||||
|       {this.id, | ||||
|         this.userName, | ||||
|         this.email, | ||||
|         this.phone, | ||||
|         this.title, | ||||
|         this.userStatus, | ||||
|         this.image, | ||||
|         this.unreadMessageCount, | ||||
|         this.userAction, | ||||
|         this.isPin, | ||||
|         this.isFav, | ||||
|         this.isAdmin, | ||||
|         this.rKey, | ||||
|         this.totalCount}); | ||||
| 
 | ||||
|   AdminUser.fromJson(Map<String, dynamic> json) { | ||||
|     id = json['id']; | ||||
|     userName = json['userName']; | ||||
|     email = json['email']; | ||||
|     phone = json['phone']; | ||||
|     title = json['title']; | ||||
|     userStatus = json['userStatus']; | ||||
|     image = json['image']; | ||||
|     unreadMessageCount = json['unreadMessageCount']; | ||||
|     userAction = json['userAction']; | ||||
|     isPin = json['isPin']; | ||||
|     isFav = json['isFav']; | ||||
|     isAdmin = json['isAdmin']; | ||||
|     rKey = json['rKey']; | ||||
|     totalCount = json['totalCount']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|      Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['id'] = this.id; | ||||
|     data['userName'] = this.userName; | ||||
|     data['email'] = this.email; | ||||
|     data['phone'] = this.phone; | ||||
|     data['title'] = this.title; | ||||
|     data['userStatus'] = this.userStatus; | ||||
|     data['image'] = this.image; | ||||
|     data['unreadMessageCount'] = this.unreadMessageCount; | ||||
|     data['userAction'] = this.userAction; | ||||
|     data['isPin'] = this.isPin; | ||||
|     data['isFav'] = this.isFav; | ||||
|     data['isAdmin'] = this.isAdmin; | ||||
|     data['rKey'] = this.rKey; | ||||
|     data['totalCount'] = this.totalCount; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class GroupUserList { | ||||
|   int? id; | ||||
|   String? userName; | ||||
|   String? email; | ||||
|   Null? phone; | ||||
|   String? title; | ||||
|   int? userStatus; | ||||
|   Null? image; | ||||
|   int? unreadMessageCount; | ||||
|   int? userAction; | ||||
|   bool? isPin; | ||||
|   bool? isFav; | ||||
|   bool? isAdmin; | ||||
|   Null? rKey; | ||||
|   int? totalCount; | ||||
| 
 | ||||
|   GroupUserList( | ||||
|       {this.id, | ||||
|         this.userName, | ||||
|         this.email, | ||||
|         this.phone, | ||||
|         this.title, | ||||
|         this.userStatus, | ||||
|         this.image, | ||||
|         this.unreadMessageCount, | ||||
|         this.userAction, | ||||
|         this.isPin, | ||||
|         this.isFav, | ||||
|         this.isAdmin, | ||||
|         this.rKey, | ||||
|         this.totalCount}); | ||||
| 
 | ||||
|   GroupUserList.fromJson(Map<String, dynamic> json) { | ||||
|     id = json['id']; | ||||
|     userName = json['userName']; | ||||
|     email = json['email']; | ||||
|     phone = json['phone']; | ||||
|     title = json['title']; | ||||
|     userStatus = json['userStatus']; | ||||
|     image = json['image']; | ||||
|     unreadMessageCount = json['unreadMessageCount']; | ||||
|     userAction = json['userAction']; | ||||
|     isPin = json['isPin']; | ||||
|     isFav = json['isFav']; | ||||
|     isAdmin = json['isAdmin']; | ||||
|     rKey = json['rKey']; | ||||
|     totalCount = json['totalCount']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|      Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['id'] = this.id; | ||||
|     data['userName'] = this.userName; | ||||
|     data['email'] = this.email; | ||||
|     data['phone'] = this.phone; | ||||
|     data['title'] = this.title; | ||||
|     data['userStatus'] = this.userStatus; | ||||
|     data['image'] = this.image; | ||||
|     data['unreadMessageCount'] = this.unreadMessageCount; | ||||
|     data['userAction'] = this.userAction; | ||||
|     data['isPin'] = this.isPin; | ||||
|     data['isFav'] = this.isFav; | ||||
|     data['isAdmin'] = this.isAdmin; | ||||
|     data['rKey'] = this.rKey; | ||||
|     data['totalCount'] = this.totalCount; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,182 @@ | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/services.dart'; | ||||
| import 'package:flutter_svg/flutter_svg.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/ui/chat/chat_detailed_screen.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'; | ||||
| import 'package:provider/provider.dart'; | ||||
| import 'package:pull_to_refresh/pull_to_refresh.dart'; | ||||
| 
 | ||||
| class GropChatHomeScreen extends StatefulWidget { | ||||
|   const GropChatHomeScreen({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   State<GropChatHomeScreen> createState() => _GropChatHomeScreenState(); | ||||
| } | ||||
| 
 | ||||
| class _GropChatHomeScreenState extends State<GropChatHomeScreen> { | ||||
|   TextEditingController search = TextEditingController(); | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
| 
 | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void dispose() { | ||||
|     super.dispose(); | ||||
|     search.clear(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|       backgroundColor: MyColors.white, | ||||
|       body: Consumer<ChatProviderModel>( | ||||
|         builder: (BuildContext context, ChatProviderModel m, Widget? child) { | ||||
|           return m.isLoading | ||||
|               ? ChatHomeShimmer( | ||||
|             isDetailedScreen: false, | ||||
|           ) | ||||
|               : Column( | ||||
|             children: <Widget>[ | ||||
|               TextField( | ||||
|                 controller: m.searchGroup, | ||||
|                 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.all(11), | ||||
|                   hintText: LocaleKeys.searchGroup.tr(), | ||||
|                   hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic, fontWeight: FontWeight.w500, fontSize: 12), | ||||
|                   filled: true, | ||||
|                   fillColor: MyColors.greyF7Color, | ||||
|                   suffixIconConstraints: const BoxConstraints(), | ||||
|                   suffixIcon: m.search.text.isNotEmpty | ||||
|                       ? IconButton( | ||||
|                     constraints: const BoxConstraints(), | ||||
|                     onPressed: () { | ||||
|                       m.clearSelections(); | ||||
|                     }, | ||||
|                     icon: const Icon(Icons.clear, size: 22), | ||||
|                     color: MyColors.redA3Color, | ||||
|                   ) | ||||
|                       : null, | ||||
|                 ), | ||||
|               ).paddingOnly(top: 20, bottom: 14), | ||||
|               if (m.userGroups.response != null) | ||||
|                 ListView.separated( | ||||
|                   itemCount: m.userGroups.response!.length, | ||||
|                   shrinkWrap: true, | ||||
|                   physics: const ClampingScrollPhysics(), | ||||
|                   padding: const EdgeInsets.only(bottom: 80.0), | ||||
|                   itemBuilder: (BuildContext context, int index) { | ||||
|                     return SizedBox( | ||||
|                       height: 55, | ||||
|                       child: Row( | ||||
|                         children: [ | ||||
| 
 | ||||
|                       Container( | ||||
|                         alignment: Alignment.center, | ||||
|                         width: 48, | ||||
|                         height: 48, | ||||
|                           padding: const EdgeInsets.all(10.0), | ||||
|                           decoration: BoxDecoration( | ||||
|                             borderRadius: BorderRadius.circular(24.0), | ||||
|                             border: Border.all(width: 1, color: Colors.black), | ||||
| 
 | ||||
|                           ), | ||||
|                               child: SvgPicture.asset( | ||||
|                                 "assets/images/chat-group.svg", | ||||
| 
 | ||||
|                               )), | ||||
|                           Column( | ||||
|                             mainAxisAlignment: MainAxisAlignment.start, | ||||
|                             crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                             children: [ | ||||
|                               (m.userGroups?.response![index].groupName!.toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 16) | ||||
|                           )!.expanded, | ||||
|                       ]) | ||||
| 
 | ||||
|                         ], | ||||
|                       ), | ||||
|                     ).onPress(() { | ||||
|                       Navigator.pushNamed( | ||||
|                         context, | ||||
|                         AppRoutes.chatDetailed, | ||||
|                         arguments: ChatDetailedScreenParams(m.searchedChats![index], false), | ||||
|                       ).then((Object? value) { | ||||
|                         m.clearSelections(); | ||||
|                         m.notifyListeners(); | ||||
|                       }); | ||||
|                     }); | ||||
|                   }, | ||||
|                   separatorBuilder: (BuildContext context, int index) => const Divider(color: MyColors.black).paddingOnly(left: 59), | ||||
|                 ).expanded, | ||||
|             ], | ||||
|           ).paddingOnly(left: 21, right: 21); | ||||
|         }, | ||||
|       ), | ||||
|       floatingActionButton: FloatingActionButton( | ||||
|         child: Container( | ||||
|           width: 60, | ||||
|           height: 60, | ||||
|           decoration: const BoxDecoration( | ||||
|             shape: BoxShape.circle, | ||||
|             gradient: LinearGradient( | ||||
|               transform: GradientRotation(.46), | ||||
|               begin: Alignment.topRight, | ||||
|               end: Alignment.bottomLeft, | ||||
|               colors: [ | ||||
|                 MyColors.gradiantEndColor, | ||||
|                 MyColors.gradiantStartColor, | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
|           child: const Icon( | ||||
|             Icons.add, | ||||
|             size: 30, | ||||
|             color: MyColors.white, | ||||
|           ), | ||||
|         ), | ||||
|         onPressed: () async { | ||||
|           print(AppState().chatDetails!.response!.token); | ||||
|           showMyBottomSheet( | ||||
|             context, | ||||
|             callBackFunc: () {}, | ||||
|             child: SearchEmployeeBottomSheet( | ||||
|               title: LocaleKeys.searchForEmployee.tr(), | ||||
|               apiMode: LocaleKeys.delegate.tr(), | ||||
|               fromChat: true, | ||||
|               onSelectEmployee: (_selectedEmployee) {}, | ||||
|             ), | ||||
|           ); | ||||
|         }, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   OutlineInputBorder fieldBorder({required double radius, required int color}) { | ||||
|     return OutlineInputBorder( | ||||
|       borderRadius: BorderRadius.circular(radius), | ||||
|       borderSide: BorderSide( | ||||
|         color: Color(color), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue
	
	 Sultan khan
						Sultan khan