merge-requests/122/head
haroon amjad 3 years ago
parent f6c5e1de41
commit 2ab39e0d7b

@ -82,7 +82,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
Future<void> buildHubConnection() async { Future<void> buildHubConnection() async {
chatHubConnection = await getHubConnection(); chatHubConnection = await getHubConnection();
await chatHubConnection.start(); await chatHubConnection.start();
if (kDebugMode) { if (kDebugMode) {
@ -1265,7 +1264,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await Directory(dirPath).create(); await Directory(dirPath).create();
await File('$dirPath/.nomedia').create(); await File('$dirPath/.nomedia').create();
} }
File file = File("$dirPath/${data.currentUserId}-${data.targetUserId}-${DateTime.now().microsecondsSinceEpoch}." + ext); File file = File("$dirPath/${data.currentUserId}-${data.targetUserId}-${DateTime.now().microsecondsSinceEpoch}" + ext);
await file.writeAsBytes(bytes); await file.writeAsBytes(bytes);
return file.path; return file.path;
} }
@ -1297,7 +1296,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
ChatUser( ChatUser(
id: int.parse(element.eMPLOYEENUMBER!), id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS, email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEEDISPLAYNAME, userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER, phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0, userStatus: 0,
unreadMessageCount: 0, unreadMessageCount: 0,
@ -1305,8 +1304,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isTyping: false, isTyping: false,
isImageLoading: false, isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "", image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: true, isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
userLocalDownlaodedImage: await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!), userLocalDownlaodedImage:element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
), ),
); );
} }
@ -1319,7 +1318,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
ChatUser( ChatUser(
id: int.parse(element.eMPLOYEENUMBER!), id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS, email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEEDISPLAYNAME, userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER, phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0, userStatus: 0,
unreadMessageCount: 0, unreadMessageCount: 0,
@ -1327,8 +1326,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isTyping: false, isTyping: false,
isImageLoading: false, isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "", image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: true, isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
userLocalDownlaodedImage: await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!), userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
), ),
); );
} }

@ -1,10 +1,10 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:audio_waveforms/audio_waveforms.dart' as awf;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:just_audio/just_audio.dart';
import 'package:mohem_flutter_app/api/chat/chat_api_client.dart'; import 'package:mohem_flutter_app/api/chat/chat_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
@ -16,9 +16,9 @@ import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.da
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/chat_full_image_preview.dart'; import 'package:mohem_flutter_app/ui/chat/chat_full_image_preview.dart';
import 'package:mohem_flutter_app/ui/chat/common.dart'; import 'package:mohem_flutter_app/ui/chat/common.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:just_audio/just_audio.dart';
class ChatBubble extends StatelessWidget { class ChatBubble extends StatelessWidget {
ChatBubble({Key? key, required this.dateTime, required this.cItem}) : super(key: key); ChatBubble({Key? key, required this.dateTime, required this.cItem}) : super(key: key);
@ -82,7 +82,8 @@ class ChatBubble extends StatelessWidget {
Utils.hideLoading(context); Utils.hideLoading(context);
await data.voiceController!.play(); await data.voiceController!.play();
} catch (e) { } catch (e) {
Utils.showToast("Cannot open file."); Utils.hideLoading(context);
Utils.showToast(e.toString());
} }
} }
} }
@ -438,5 +439,3 @@ class ChatBubble extends StatelessWidget {
); );
} }
} }

@ -84,24 +84,24 @@ class _MyTeamScreenState extends State<MyTeamScreen> {
), ),
), ),
), ),
Positioned( // Positioned(
right: 5, // right: 5,
bottom: 1, // bottom: 1,
child: Container( // child: Container(
width: 10, // width: 10,
height: 10, // height: 10,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red, // color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
), // ),
).circle(10), // ).circle(10),
) // )
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
(m.teamMembersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13), (m.teamMembersList![index].userName! ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13),
], ],
).expanded, ).expanded,
// SizedBox( // SizedBox(
@ -128,16 +128,15 @@ class _MyTeamScreenState extends State<MyTeamScreen> {
], ],
), ),
).onPress(() { ).onPress(() {
print(jsonEncode(m.teamMembersList[index])); Navigator.pushNamed(
// Navigator.pushNamed( context,
// context, AppRoutes.chatDetailed,
// AppRoutes.chatDetailed, arguments: ChatDetailedScreenParams(m.teamMembersList![index], true),
// arguments: ChatDetailedScreenParams(m.teamMembersList![index], true), ).then(
// ).then( (Object? value) {
// (Object? value) { m.clearSelections();
// m.clearSelections(); },
// }, );
// );
}); });
}, },
separatorBuilder: (BuildContext context, int index) => const Divider(color: MyColors.lightGreyE5Color).paddingOnly(left: 70), separatorBuilder: (BuildContext context, int index) => const Divider(color: MyColors.lightGreyE5Color).paddingOnly(left: 70),

Loading…
Cancel
Save