forked from eatvio/eatvio_app
fix(chat): change sendChatMessage method
This commit is contained in:
@@ -341,7 +341,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
children: [
|
||||
const SizedBox(width: 8),
|
||||
InkWell(
|
||||
onTap: () => showImagePicker(),
|
||||
onTap: () => showImagePicker(state.chatRoom.users.receiver.slug),
|
||||
customBorder: const CircleBorder(),
|
||||
child: Ink(
|
||||
height: 40,
|
||||
@@ -386,7 +386,11 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: () {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
chatRoomCubit.sendMessage(chatId: widget.chatId, data: textEditingController.text.trim());
|
||||
chatRoomCubit.sendMessage(
|
||||
chatId: widget.chatId,
|
||||
data: textEditingController.text.trim(),
|
||||
userSlug: state.chatRoom.users.receiver.slug,
|
||||
);
|
||||
setState(() {
|
||||
textEditingController.clear();
|
||||
});
|
||||
@@ -421,7 +425,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
showImagePicker() {
|
||||
showImagePicker(String slug) {
|
||||
showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoActionSheet(
|
||||
@@ -432,7 +436,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
final picker = ImagePicker();
|
||||
XFile? image = await picker.pickImage(source: ImageSource.camera);
|
||||
if (image != null) {
|
||||
await chatRoomCubit.sendMessage(chatId: widget.chatId, files: [File(image.path)]);
|
||||
await chatRoomCubit.sendMessage(chatId: widget.chatId, files: [File(image.path)], userSlug: slug);
|
||||
}
|
||||
},
|
||||
child: const Row(
|
||||
@@ -472,7 +476,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
if (result != null) {
|
||||
List<File> files = result.paths.map((path) => File(path!)).toList();
|
||||
await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files);
|
||||
await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files, userSlug: slug);
|
||||
}
|
||||
},
|
||||
child: const Row(
|
||||
|
||||
Reference in New Issue
Block a user