|
|
|
@ -1,5 +1,4 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -21,7 +20,10 @@ class ChatDetailScreen extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
userDetails = ModalRoute.of(context)!.settings.arguments;
|
|
|
|
userDetails = ModalRoute
|
|
|
|
|
|
|
|
.of(context)!
|
|
|
|
|
|
|
|
.settings
|
|
|
|
|
|
|
|
.arguments;
|
|
|
|
data = Provider.of<ChatProviderModel>(context, listen: false);
|
|
|
|
data = Provider.of<ChatProviderModel>(context, listen: false);
|
|
|
|
data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0");
|
|
|
|
data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0");
|
|
|
|
Timer(const Duration(seconds: 1), () => data.scrollDown());
|
|
|
|
Timer(const Duration(seconds: 1), () => data.scrollDown());
|
|
|
|
@ -33,56 +35,72 @@ class ChatDetailScreen extends StatelessWidget {
|
|
|
|
return (m.isLoading
|
|
|
|
return (m.isLoading
|
|
|
|
? ChatHomeShimmer()
|
|
|
|
? ChatHomeShimmer()
|
|
|
|
: Column(
|
|
|
|
: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
child: ListView.builder(
|
|
|
|
controller: m.scrollController,
|
|
|
|
controller: m.scrollController,
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: m.userChatHistory.length,
|
|
|
|
itemCount: m.userChatHistory.length,
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
itemBuilder: (BuildContext context, int i) {
|
|
|
|
itemBuilder: (BuildContext context, int i) {
|
|
|
|
return ChatBubble(
|
|
|
|
return ChatBubble(
|
|
|
|
text: m.userChatHistory[i].contant.toString(),
|
|
|
|
text: m.userChatHistory[i].contant.toString(),
|
|
|
|
isSeen: m.userChatHistory[i].isSeen == true ? true : false,
|
|
|
|
isSeen: m.userChatHistory[i].isSeen == true ? true : false,
|
|
|
|
isCurrentUser: m.userChatHistory[i].currentUserId == 42062 ? true : false,
|
|
|
|
isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false,
|
|
|
|
isDelivered: m.userChatHistory[i].currentUserId == 42062 && m.userChatHistory[i].isDelivered == true ? true : false,
|
|
|
|
isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false,
|
|
|
|
dateTime: m.userChatHistory[i].createdDate.toString(),
|
|
|
|
dateTime: m.userChatHistory[i].createdDate.toString(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Card(
|
|
|
|
Card(
|
|
|
|
margin: EdgeInsets.zero,
|
|
|
|
margin: EdgeInsets.zero,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
child: TextField(
|
|
|
|
child: TextField(
|
|
|
|
controller: m.message,
|
|
|
|
controller: m.message,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: LocaleKeys.typeheretoreply.tr(),
|
|
|
|
hintText: LocaleKeys.typeheretoreply.tr(),
|
|
|
|
hintStyle: const TextStyle(color: MyColors.grey98Color),
|
|
|
|
hintStyle: const TextStyle(color: MyColors.grey98Color),
|
|
|
|
border: InputBorder.none,
|
|
|
|
border: InputBorder.none,
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
errorBorder: InputBorder.none,
|
|
|
|
errorBorder: InputBorder.none,
|
|
|
|
disabledBorder: InputBorder.none,
|
|
|
|
disabledBorder: InputBorder.none,
|
|
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
|
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
suffixIcon: SizedBox(
|
|
|
|
|
|
|
|
width: 100,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.attach_file_rounded,
|
|
|
|
|
|
|
|
size: 27,
|
|
|
|
|
|
|
|
color: MyColors.lightGreenColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
"assets/icons/chat/chat_send_icon.svg",
|
|
|
|
"assets/icons/chat/chat_send_icon.svg",
|
|
|
|
height: 26,
|
|
|
|
height: 26,
|
|
|
|
width: 35,
|
|
|
|
width: 35,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
// m.logger.d(userDetails);
|
|
|
|
m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName);
|
|
|
|
m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|