Chat Fixes

merge-requests/107/head
Aamir Muhammad 3 years ago
parent cf87a6da05
commit 9f91f1e83c

@ -371,7 +371,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
setMsgTune();
if (isChatScreenActive) {
if (data.first.targetUserId == AppState().chatDetails!.response!.id) {
userChatHistory.insert(0, data.first);
}
}
if (searchedChats != null && !isChatScreenActive) {
for (ChatUser user in searchedChats!) {
@ -868,7 +872,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void onNewChatConversion(List<Object?>? params) {
dynamic items = params!.toList();
logger.d(items);
chatUConvCounter = items[0]["singleChatCount"] ?? 0;
notifyListeners();
}

@ -101,15 +101,22 @@ class ChatBubble extends StatelessWidget {
],
),
),
).paddingOnly(right: 5, bottom: 7),
).paddingOnly(bottom: 7),
if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3)
showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).paddingOnly(right: 5).onPress(() {
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: SizedBox(
height: 140,
width: 227,
child: showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant!, img: cItem.image!),
);
})
}),
),
).paddingOnly(bottom: 4)
else
Row(
children: [
@ -132,12 +139,12 @@ class ChatBubble extends StatelessWidget {
),
),
],
).paddingOnly(top: 11, left: 13, right: 7, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3);
).paddingOnly(top: 11, left: 13, right: 13, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3);
}
Widget receiptUser(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 11, left: 13, right: 7, bottom: 5),
padding: const EdgeInsets.only(top: 11, left: 13, right: 13, bottom: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
gradient: const LinearGradient(
@ -190,15 +197,22 @@ class ChatBubble extends StatelessWidget {
],
),
),
).paddingOnly(right: 5, bottom: 7),
).paddingOnly(bottom: 7),
if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3)
showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").paddingOnly(right: 5).onPress(() {
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: SizedBox(
height: 140,
width: 227,
child: showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant ?? "", img: cItem.image!),
);
})
}),
),
).paddingOnly(bottom: 4)
else
Row(
children: [
@ -212,7 +226,9 @@ class ChatBubble extends StatelessWidget {
),
Align(
alignment: Alignment.centerRight,
child: dateTime.toText10(color: Colors.white.withOpacity(.71),),
child: dateTime.toText10(
color: Colors.white.withOpacity(.71),
),
),
],
),
@ -220,12 +236,15 @@ class ChatBubble extends StatelessWidget {
}
Widget showImage({required bool isReplyPreview, required String fileName, required String fileTypeDescription}) {
if (isReplyPreview) {}
if (cItem.isImageLoaded! && cItem.image != null) {
return Image.memory(
cItem.image!,
height: isReplyPreview ? 32 : 140,
width: isReplyPreview ? 32 : 227,
fit: BoxFit.cover,
alignment: Alignment.center,
);
} else {
return FutureBuilder<Uint8List>(
@ -233,7 +252,7 @@ class ChatBubble extends StatelessWidget {
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState != ConnectionState.waiting) {
if (snapshot.data == null) {
return SizedBox();
return const SizedBox();
} else {
cItem.image = snapshot.data;
cItem.isImageLoaded = true;
@ -242,6 +261,7 @@ class ChatBubble extends StatelessWidget {
height: isReplyPreview ? 32 : 140,
width: isReplyPreview ? 32 : 227,
fit: BoxFit.cover,
alignment: Alignment.center,
);
}
} else {

Loading…
Cancel
Save