|
|
|
@ -95,145 +95,147 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|
|
|
21.width,
|
|
|
|
21.width,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: Consumer<ChatProviderModel>(
|
|
|
|
body: SafeArea(
|
|
|
|
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
|
|
|
|
child: Consumer<ChatProviderModel>(
|
|
|
|
return (m.isLoading
|
|
|
|
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
|
|
|
|
? ChatHomeShimmer(
|
|
|
|
return (m.isLoading
|
|
|
|
isDetailedScreen: true,
|
|
|
|
? ChatHomeShimmer(
|
|
|
|
)
|
|
|
|
isDetailedScreen: true,
|
|
|
|
: Column(
|
|
|
|
)
|
|
|
|
children: <Widget>[
|
|
|
|
: Column(
|
|
|
|
SmartRefresher(
|
|
|
|
children: <Widget>[
|
|
|
|
enablePullDown: false,
|
|
|
|
SmartRefresher(
|
|
|
|
enablePullUp: true,
|
|
|
|
enablePullDown: false,
|
|
|
|
onLoading: () {
|
|
|
|
enablePullUp: true,
|
|
|
|
getMoreChat();
|
|
|
|
onLoading: () {
|
|
|
|
},
|
|
|
|
getMoreChat();
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
controller: _rc,
|
|
|
|
|
|
|
|
reverse: true,
|
|
|
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
|
|
|
controller: m.scrollController,
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
|
|
|
reverse: true,
|
|
|
|
|
|
|
|
itemCount: m.userChatHistory.length,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
|
|
|
separatorBuilder: (cxt, index) => 8.height,
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int i) {
|
|
|
|
|
|
|
|
return SwipeTo(
|
|
|
|
|
|
|
|
iconColor: MyColors.lightGreenColor,
|
|
|
|
|
|
|
|
child: ChatBubble(
|
|
|
|
|
|
|
|
dateTime: m.dateFormte(m.userChatHistory[i].createdDate!),
|
|
|
|
|
|
|
|
cItem: m.userChatHistory[i],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onRightSwipe: () {
|
|
|
|
|
|
|
|
m.chatReply(
|
|
|
|
|
|
|
|
m.userChatHistory[i],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
).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!);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
).expanded,
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
if (m.isMsgReply)
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 82,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Container(height: 82, color: MyColors.textMixColor, width: 6),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
color: MyColors.darkTextColor.withOpacity(0.10),
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(top: 11, left: 14, bottom: 14, right: 21),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
(AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString()
|
|
|
|
|
|
|
|
? "You"
|
|
|
|
|
|
|
|
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
|
|
|
|
|
|
|
|
.toText14(color: MyColors.lightGreenColor),
|
|
|
|
|
|
|
|
(m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.grey71Color, maxLine: 2)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
12.width,
|
|
|
|
|
|
|
|
if (m.isMsgReply && m.repliedMsg.isNotEmpty) showReplyImage(m.repliedMsg, m),
|
|
|
|
|
|
|
|
12.width,
|
|
|
|
|
|
|
|
const Icon(Icons.cancel, size: 23, color: MyColors.grey7BColor).onPress(m.closeMe),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
controller: _rc,
|
|
|
|
if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg")
|
|
|
|
reverse: true,
|
|
|
|
SizedBox(height: 200, width: double.infinity, child: Image.file(m.selectedFile, fit: BoxFit.cover)).paddingOnly(left: 21, right: 21, top: 21),
|
|
|
|
child: ListView.separated(
|
|
|
|
const Divider(
|
|
|
|
controller: m.scrollController,
|
|
|
|
height: 1,
|
|
|
|
shrinkWrap: true,
|
|
|
|
color: MyColors.lightGreyEFColor,
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
),
|
|
|
|
reverse: true,
|
|
|
|
TextField(
|
|
|
|
itemCount: m.userChatHistory.length,
|
|
|
|
controller: m.message,
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
decoration: InputDecoration(
|
|
|
|
separatorBuilder: (cxt, index) => 8.height,
|
|
|
|
hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
|
|
|
|
itemBuilder: (BuildContext context, int i) {
|
|
|
|
hintStyle: TextStyle(color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
|
|
|
|
return SwipeTo(
|
|
|
|
border: InputBorder.none,
|
|
|
|
iconColor: MyColors.lightGreenColor,
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
child: ChatBubble(
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
dateTime: m.dateFormte(m.userChatHistory[i].createdDate!),
|
|
|
|
errorBorder: InputBorder.none,
|
|
|
|
cItem: m.userChatHistory[i],
|
|
|
|
disabledBorder: InputBorder.none,
|
|
|
|
),
|
|
|
|
filled: true,
|
|
|
|
onRightSwipe: () {
|
|
|
|
fillColor: MyColors.white,
|
|
|
|
m.chatReply(
|
|
|
|
contentPadding: const EdgeInsets.only(
|
|
|
|
m.userChatHistory[i],
|
|
|
|
left: 21,
|
|
|
|
);
|
|
|
|
top: 20,
|
|
|
|
},
|
|
|
|
bottom: 20,
|
|
|
|
).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!);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
prefixIconConstraints: const BoxConstraints(),
|
|
|
|
).expanded,
|
|
|
|
prefixIcon: m.sFileType.isNotEmpty
|
|
|
|
if (m.isMsgReply)
|
|
|
|
? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15)
|
|
|
|
SizedBox(
|
|
|
|
: null,
|
|
|
|
height: 82,
|
|
|
|
suffixIcon: SizedBox(
|
|
|
|
|
|
|
|
width: 100,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, // added line
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
if (m.sFileType.isNotEmpty)
|
|
|
|
Container(height: 82, color: MyColors.textMixColor, width: 6),
|
|
|
|
Row(
|
|
|
|
Container(
|
|
|
|
children: <Widget>[
|
|
|
|
color: MyColors.darkTextColor.withOpacity(0.10),
|
|
|
|
const Icon(Icons.cancel, size: 15, color: MyColors.redA3Color).paddingOnly(right: 5),
|
|
|
|
padding: const EdgeInsets.only(top: 11, left: 14, bottom: 14, right: 21),
|
|
|
|
("Clear").toText11(color: MyColors.redA3Color, isUnderLine: true).paddingOnly(left: 0),
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
(AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString()
|
|
|
|
|
|
|
|
? "You"
|
|
|
|
|
|
|
|
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
|
|
|
|
|
|
|
|
.toText14(color: MyColors.lightGreenColor),
|
|
|
|
|
|
|
|
(m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.grey71Color, maxLine: 2)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
).expanded,
|
|
|
|
|
|
|
|
12.width,
|
|
|
|
|
|
|
|
if (m.isMsgReply && m.repliedMsg.isNotEmpty) showReplyImage(m.repliedMsg, m),
|
|
|
|
|
|
|
|
12.width,
|
|
|
|
|
|
|
|
const Icon(Icons.cancel, size: 23, color: MyColors.grey7BColor).onPress(m.closeMe),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).onPress(() => m.removeAttachment()).paddingOnly(right: 25),
|
|
|
|
),
|
|
|
|
if (m.sFileType.isEmpty)
|
|
|
|
).expanded,
|
|
|
|
RotationTransition(
|
|
|
|
|
|
|
|
turns: const AlwaysStoppedAnimation(45 / 360),
|
|
|
|
|
|
|
|
child: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor).onPress(
|
|
|
|
|
|
|
|
() => m.selectImageToUpload(context),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).paddingOnly(right: 25),
|
|
|
|
|
|
|
|
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26).onPress(
|
|
|
|
|
|
|
|
() => m.sendChatMessage(params!.chatUser!.id!, params!.chatUser!.userName!, context),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).paddingOnly(right: 21),
|
|
|
|
),
|
|
|
|
|
|
|
|
if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg")
|
|
|
|
|
|
|
|
SizedBox(height: 200, width: double.infinity, child: Image.file(m.selectedFile, fit: BoxFit.cover)).paddingOnly(left: 21, right: 21, top: 21),
|
|
|
|
|
|
|
|
const Divider(
|
|
|
|
|
|
|
|
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),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).paddingOnly(right: 25),
|
|
|
|
|
|
|
|
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26).onPress(
|
|
|
|
|
|
|
|
() => m.sendChatMessage(params!.chatUser!.id!, params!.chatUser!.userName!, context),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
).paddingOnly(right: 21),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
));
|
|
|
|
));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -248,14 +250,14 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|
|
|
border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), image: DecorationImage(image: MemoryImage(data.first.image!), fit: BoxFit.cover)),
|
|
|
|
border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), image: DecorationImage(image: MemoryImage(data.first.image!), fit: BoxFit.cover)),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return data.first.fileTypeResponse != null
|
|
|
|
return data.first.fileTypeResponse != null && data.first.fileTypeResponse!.fileTypeName != null
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
width: 43,
|
|
|
|
width: 43,
|
|
|
|
height: 43,
|
|
|
|
height: 43,
|
|
|
|
constraints: BoxConstraints(),
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
decoration: BoxDecoration(border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), color: Colors.white),
|
|
|
|
decoration: BoxDecoration(border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), color: Colors.white),
|
|
|
|
child: SvgPicture.asset(m.getType(data.first.fileTypeResponse!.fileTypeName), alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 5, right: 5, top: 5, bottom: 5))
|
|
|
|
child: SvgPicture.asset(m.getType(data.first.fileTypeResponse!.fileTypeName ?? ""), alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 5, right: 5, top: 5, bottom: 5))
|
|
|
|
: SizedBox();
|
|
|
|
: const SizedBox();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|