|  |  |  | @ -1,6 +1,7 @@ | 
		
	
		
			
				|  |  |  |  | import 'dart:async'; | 
		
	
		
			
				|  |  |  |  | import 'dart:convert'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import 'package:audio_waveforms/audio_waveforms.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:easy_localization/easy_localization.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_svg/flutter_svg.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -62,6 +63,12 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> { | 
		
	
		
			
				|  |  |  |  |     _rc.loadComplete(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void dispose() { | 
		
	
		
			
				|  |  |  |  |     data.disposeAudio(); | 
		
	
		
			
				|  |  |  |  |     super.dispose(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Widget build(BuildContext context) { | 
		
	
		
			
				|  |  |  |  |     params = ModalRoute.of(context)!.settings.arguments as ChatDetailedScreenParams; | 
		
	
	
		
			
				
					|  |  |  | @ -73,6 +80,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> { | 
		
	
		
			
				|  |  |  |  |         loadMore: false, | 
		
	
		
			
				|  |  |  |  |         isNewChat: params!.isNewChat!, | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       data.initAudio(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     return Scaffold( | 
		
	
	
		
			
				
					|  |  |  | @ -181,62 +189,140 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> { | 
		
	
		
			
				|  |  |  |  |                         height: 1, | 
		
	
		
			
				|  |  |  |  |                         color: MyColors.lightGreyEFColor, | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
		
			
				|  |  |  |  |                       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, | 
		
	
		
			
				|  |  |  |  |                           filled: true, | 
		
	
		
			
				|  |  |  |  |                           fillColor: MyColors.white, | 
		
	
		
			
				|  |  |  |  |                           contentPadding: const EdgeInsets.only( | 
		
	
		
			
				|  |  |  |  |                             left: 21, | 
		
	
		
			
				|  |  |  |  |                             top: 20, | 
		
	
		
			
				|  |  |  |  |                             bottom: 20, | 
		
	
		
			
				|  |  |  |  |                           ), | 
		
	
		
			
				|  |  |  |  |                           prefixIconConstraints: const BoxConstraints(), | 
		
	
		
			
				|  |  |  |  |                           prefixIcon: m.sFileType.isNotEmpty | 
		
	
		
			
				|  |  |  |  |                               ? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15) | 
		
	
		
			
				|  |  |  |  |                               : null, | 
		
	
		
			
				|  |  |  |  |                           suffixIcon: SizedBox( | 
		
	
		
			
				|  |  |  |  |                             width: 100, | 
		
	
		
			
				|  |  |  |  |                             child: Row( | 
		
	
		
			
				|  |  |  |  |                               mainAxisAlignment: MainAxisAlignment.end, | 
		
	
		
			
				|  |  |  |  |                               crossAxisAlignment: CrossAxisAlignment.center, // added line | 
		
	
		
			
				|  |  |  |  |                               children: <Widget>[ | 
		
	
		
			
				|  |  |  |  |                                 if (m.sFileType.isNotEmpty) | 
		
	
		
			
				|  |  |  |  |                                   Row( | 
		
	
		
			
				|  |  |  |  |                                     children: <Widget>[ | 
		
	
		
			
				|  |  |  |  |                                       const Icon(Icons.cancel, size: 15, color: MyColors.redA3Color).paddingOnly(right: 5), | 
		
	
		
			
				|  |  |  |  |                                       ("Clear").toText11(color: MyColors.redA3Color, isUnderLine: true).paddingOnly(left: 0), | 
		
	
		
			
				|  |  |  |  |                                     ], | 
		
	
		
			
				|  |  |  |  |                                   ).onPress(() => m.removeAttachment()).paddingOnly(right: 25), | 
		
	
		
			
				|  |  |  |  |                                 if (m.sFileType.isEmpty) | 
		
	
		
			
				|  |  |  |  |                                   RotationTransition( | 
		
	
		
			
				|  |  |  |  |                                     turns: const AlwaysStoppedAnimation(45 / 360), | 
		
	
		
			
				|  |  |  |  |                                     child: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor).onPress( | 
		
	
		
			
				|  |  |  |  |                                       () => m.selectImageToUpload(context), | 
		
	
		
			
				|  |  |  |  |                       if (m.isRecoding) | 
		
	
		
			
				|  |  |  |  |                         Column( | 
		
	
		
			
				|  |  |  |  |                           children: <Widget>[ | 
		
	
		
			
				|  |  |  |  |                             Row( | 
		
	
		
			
				|  |  |  |  |                               children: [ | 
		
	
		
			
				|  |  |  |  |                                 Text(m.buildTimer()).paddingAll(10), | 
		
	
		
			
				|  |  |  |  |                                 if (m.isRecoding && m.isPlaying) | 
		
	
		
			
				|  |  |  |  |                                   WaveBubble( | 
		
	
		
			
				|  |  |  |  |                                           playerController: m.playerController, | 
		
	
		
			
				|  |  |  |  |                                           onTap: () { | 
		
	
		
			
				|  |  |  |  |                                             m.playOrPause(); | 
		
	
		
			
				|  |  |  |  |                                           }, | 
		
	
		
			
				|  |  |  |  |                                           isPlaying: m.playerController.playerState == PlayerState.playing) | 
		
	
		
			
				|  |  |  |  |                                       .expanded | 
		
	
		
			
				|  |  |  |  |                                 else | 
		
	
		
			
				|  |  |  |  |                                   AudioWaveforms( | 
		
	
		
			
				|  |  |  |  |                                     waveStyle: const WaveStyle( | 
		
	
		
			
				|  |  |  |  |                                       waveColor: MyColors.lightGreenColor, | 
		
	
		
			
				|  |  |  |  |                                       middleLineColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |                                       extendWaveform: true, | 
		
	
		
			
				|  |  |  |  |                                       showBottom: true, | 
		
	
		
			
				|  |  |  |  |                                       showTop: true, | 
		
	
		
			
				|  |  |  |  |                                       waveThickness: 2, | 
		
	
		
			
				|  |  |  |  |                                       showMiddleLine: false, | 
		
	
		
			
				|  |  |  |  |                                       middleLineThickness: 0, | 
		
	
		
			
				|  |  |  |  |                                     ), | 
		
	
		
			
				|  |  |  |  |                                   ).paddingOnly(right: 25), | 
		
	
		
			
				|  |  |  |  |                                 SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26).onPress( | 
		
	
		
			
				|  |  |  |  |                                     padding: const EdgeInsets.all(5), | 
		
	
		
			
				|  |  |  |  |                                     shouldCalculateScrolledPosition: false, | 
		
	
		
			
				|  |  |  |  |                                     margin: EdgeInsets.zero, | 
		
	
		
			
				|  |  |  |  |                                     size: const Size(double.infinity, 30.0), | 
		
	
		
			
				|  |  |  |  |                                     recorderController: m.recorderController, | 
		
	
		
			
				|  |  |  |  |                                     backgroundColor: Colors.white, | 
		
	
		
			
				|  |  |  |  |                                   ).expanded, | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                             ), | 
		
	
		
			
				|  |  |  |  |                             Row( | 
		
	
		
			
				|  |  |  |  |                               mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
		
	
		
			
				|  |  |  |  |                               children: [ | 
		
	
		
			
				|  |  |  |  |                                 const Icon( | 
		
	
		
			
				|  |  |  |  |                                   Icons.delete_outlined, | 
		
	
		
			
				|  |  |  |  |                                   size: 26, | 
		
	
		
			
				|  |  |  |  |                                   color: MyColors.lightGreenColor, | 
		
	
		
			
				|  |  |  |  |                                 ).paddingAll(10).onPress(() { | 
		
	
		
			
				|  |  |  |  |                                   m.deleteRecoding(); | 
		
	
		
			
				|  |  |  |  |                                 }), | 
		
	
		
			
				|  |  |  |  |                                 if (m.isPause) | 
		
	
		
			
				|  |  |  |  |                                   const Icon( | 
		
	
		
			
				|  |  |  |  |                                     Icons.mic, | 
		
	
		
			
				|  |  |  |  |                                     size: 26, | 
		
	
		
			
				|  |  |  |  |                                     color: MyColors.lightGreenColor, | 
		
	
		
			
				|  |  |  |  |                                   ).paddingOnly(right: 15).onPress(() { | 
		
	
		
			
				|  |  |  |  |                                     m.resumeRecoding(); | 
		
	
		
			
				|  |  |  |  |                                   }), | 
		
	
		
			
				|  |  |  |  |                                 if (!m.isPause) | 
		
	
		
			
				|  |  |  |  |                                   const Icon( | 
		
	
		
			
				|  |  |  |  |                                     Icons.pause_circle_outline, | 
		
	
		
			
				|  |  |  |  |                                     size: 26, | 
		
	
		
			
				|  |  |  |  |                                     color: MyColors.lightGreenColor, | 
		
	
		
			
				|  |  |  |  |                                   ).paddingOnly(right: 15).onPress(() { | 
		
	
		
			
				|  |  |  |  |                                     m.pauseRecoding(); | 
		
	
		
			
				|  |  |  |  |                                   }), | 
		
	
		
			
				|  |  |  |  |                                 SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26) | 
		
	
		
			
				|  |  |  |  |                                     .onPress( | 
		
	
		
			
				|  |  |  |  |                                       () => m.sendChatMessage(context, | 
		
	
		
			
				|  |  |  |  |                                           targetUserId: params!.chatUser!.id!, | 
		
	
		
			
				|  |  |  |  |                                           userStatus: params!.chatUser!.userStatus ?? 0, | 
		
	
		
			
				|  |  |  |  |                                           userEmail: params!.chatUser!.email!, | 
		
	
		
			
				|  |  |  |  |                                           targetUserName: params!.chatUser!.userName!), | 
		
	
		
			
				|  |  |  |  |                                     ) | 
		
	
		
			
				|  |  |  |  |                                     .paddingOnly(right: 21), | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                             ), | 
		
	
		
			
				|  |  |  |  |                           ], | 
		
	
		
			
				|  |  |  |  |                         ).objectContainerView(disablePadding: true, radius: 0), | 
		
	
		
			
				|  |  |  |  |                       if (!m.isRecoding) | 
		
	
		
			
				|  |  |  |  |                         Row( | 
		
	
		
			
				|  |  |  |  |                           children: [ | 
		
	
		
			
				|  |  |  |  |                             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, | 
		
	
		
			
				|  |  |  |  |                                 filled: true, | 
		
	
		
			
				|  |  |  |  |                                 fillColor: MyColors.white, | 
		
	
		
			
				|  |  |  |  |                                 contentPadding: const EdgeInsets.only( | 
		
	
		
			
				|  |  |  |  |                                   left: 21, | 
		
	
		
			
				|  |  |  |  |                                   top: 20, | 
		
	
		
			
				|  |  |  |  |                                   bottom: 20, | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                                 prefixIconConstraints: const BoxConstraints(), | 
		
	
		
			
				|  |  |  |  |                                 prefixIcon: m.sFileType.isNotEmpty | 
		
	
		
			
				|  |  |  |  |                                     ? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15) | 
		
	
		
			
				|  |  |  |  |                                     : null, | 
		
	
		
			
				|  |  |  |  |                               ), | 
		
	
		
			
				|  |  |  |  |                               onChanged: (val) { | 
		
	
		
			
				|  |  |  |  |                                 m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!); | 
		
	
		
			
				|  |  |  |  |                               }, | 
		
	
		
			
				|  |  |  |  |                             ).expanded, | 
		
	
		
			
				|  |  |  |  |                             if (m.sFileType.isNotEmpty) | 
		
	
		
			
				|  |  |  |  |                               Row( | 
		
	
		
			
				|  |  |  |  |                                 children: <Widget>[ | 
		
	
		
			
				|  |  |  |  |                                   const Icon(Icons.cancel, size: 15, color: MyColors.redA3Color).paddingOnly(right: 5), | 
		
	
		
			
				|  |  |  |  |                                   ("Clear").toText11(color: MyColors.redA3Color, isUnderLine: true).paddingOnly(left: 0), | 
		
	
		
			
				|  |  |  |  |                                 ], | 
		
	
		
			
				|  |  |  |  |                               ).onPress(() => m.removeAttachment()).paddingOnly(right: 15), | 
		
	
		
			
				|  |  |  |  |                             if (m.sFileType.isEmpty) | 
		
	
		
			
				|  |  |  |  |                               RotationTransition( | 
		
	
		
			
				|  |  |  |  |                                 turns: const AlwaysStoppedAnimation(45 / 360), | 
		
	
		
			
				|  |  |  |  |                                 child: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor).onPress( | 
		
	
		
			
				|  |  |  |  |                                   () => m.selectImageToUpload(context), | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                               ).paddingOnly(right: 15), | 
		
	
		
			
				|  |  |  |  |                             Icon( | 
		
	
		
			
				|  |  |  |  |                               Icons.mic, | 
		
	
		
			
				|  |  |  |  |                               color: MyColors.lightGreenColor, | 
		
	
		
			
				|  |  |  |  |                             ).paddingOnly(right: 15).onPress(() { | 
		
	
		
			
				|  |  |  |  |                               m.startRecoding(); | 
		
	
		
			
				|  |  |  |  |                             }), | 
		
	
		
			
				|  |  |  |  |                             SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26) | 
		
	
		
			
				|  |  |  |  |                                 .onPress( | 
		
	
		
			
				|  |  |  |  |                                   () => m.sendChatMessage(context, | 
		
	
		
			
				|  |  |  |  |                                       targetUserId: params!.chatUser!.id!, | 
		
	
		
			
				|  |  |  |  |                                       userStatus: params!.chatUser!.userStatus ?? 0, | 
		
	
		
			
				|  |  |  |  |                                       userEmail: params!.chatUser!.email!, | 
		
	
		
			
				|  |  |  |  |                                       targetUserName: params!.chatUser!.userName!), | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                             ), | 
		
	
		
			
				|  |  |  |  |                           ).paddingOnly(right: 21), | 
		
	
		
			
				|  |  |  |  |                         ), | 
		
	
		
			
				|  |  |  |  |                         onChanged: (val) { | 
		
	
		
			
				|  |  |  |  |                           m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!); | 
		
	
		
			
				|  |  |  |  |                         }, | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
		
			
				|  |  |  |  |                                 ) | 
		
	
		
			
				|  |  |  |  |                                 .paddingOnly(right: 21), | 
		
	
		
			
				|  |  |  |  |                           ], | 
		
	
		
			
				|  |  |  |  |                         ).objectContainerView(disablePadding: true, radius: 0), | 
		
	
		
			
				|  |  |  |  |                     ], | 
		
	
		
			
				|  |  |  |  |                   )); | 
		
	
		
			
				|  |  |  |  |           }, | 
		
	
	
		
			
				
					|  |  |  | 
 |