Chat Fixes & Counter Updated on Signal R

sultan-dev
Aamir Muhammad 2 years ago
parent 668efb8412
commit ae559df29f

@ -405,7 +405,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (user.id == parameters![1] && parameters[0] == true) {
user.isTyping = parameters[0] as bool?;
Future.delayed(
const Duration(seconds: 1),
const Duration(seconds: 2),
() {
user.isTyping = false;
notifyListeners();
@ -839,12 +839,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
Future<void> getChatMedia({required String fileName, required String fileTypeName, required int fileTypeID}) async {
Future<void> getChatMedia(BuildContext context, {required String fileName, required String fileTypeName, required int fileTypeID}) async {
Utils.showLoading(context);
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) {
Uint8List encodedString = await ChatApiClient().downloadURL(fileName: fileName, fileTypeDescription: getFileTypeDescription(fileTypeName));
try {
String path = await downChatMedia(encodedString, fileTypeName ?? "");
Utils.hideLoading(context);
OpenFile.open(path);
} catch (e) {
Utils.showToast("Cannot open file.");
}

@ -137,10 +137,8 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
},
).onPress(() async {
if (m.userChatHistory[i].fileTypeResponse != null) {
m.getChatMedia(
fileTypeName: m.userChatHistory[i].fileTypeResponse!.fileTypeName ?? "",
fileTypeID: m.userChatHistory[i].fileTypeResponse!.fileTypeId!,
fileName: m.userChatHistory[i].contant!);
m.getChatMedia(context,
fileTypeName: m.userChatHistory[i].fileTypeResponse!.fileTypeName ?? "", fileTypeID: m.userChatHistory[i].fileTypeId!, fileName: m.userChatHistory[i].contant!);
}
});
},

@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -137,7 +138,14 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(m.searchedChats![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13),
(m.searchedChats![index].isTyping! ? "Typing ..." : "").toText10(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 0),
m.searchedChats![index].isTyping!
? AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText('Typing...', textStyle: const TextStyle(color: MyColors.textMixColor, fontSize: 10, letterSpacing: -0.4, fontStyle: FontStyle.normal)),
],
).paddingOnly(left: 11)
: const SizedBox()
//(m.searchedChats![index].isTyping! ? "Typing ..." : "").toText10(color: MyColors.textMixColor).paddingOnly(left: 11, top: 0),
],
).expanded,
SizedBox(

@ -1,3 +1,4 @@
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
@ -50,14 +51,19 @@ AppBar ChatAppBarWidget(BuildContext context,
Consumer<ChatProviderModel>(
builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
if (chatUser!.isTyping!) {
return ("Typing ...").toText10(color: MyColors.darkTextColor);
// return ("Typing ...").toText10(color: MyColors.textMixColor);
return AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText('Typing...', textStyle: const TextStyle(color: MyColors.textMixColor, fontSize: 10, letterSpacing: -0.4, fontStyle: FontStyle.normal)),
],
);
} else {
return const SizedBox();
}
},
),
],
).expanded,
),
)
],
),

@ -92,6 +92,7 @@ dependencies:
swipe_to: ^1.0.2
flutter_webrtc: ^0.9.16
camera: ^0.10.0+4
animated_text_kit: ^4.2.2
#Encryption
flutter_des: ^2.1.0

Loading…
Cancel
Save