Comments (5)
Ok
(BTW, huge thanks for this incredible package)
from dash-chat-2.
update!
i was able to reproduce the bug in the example project
as you can see in the attached video
Screen.Recording.2022-09-17.at.21.34.43.mov
the following is the add video button
`
[
IconButton(
icon: Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
allowedExtensions: [
'jpg',
'png',
'jpeg',
'mov',
'mp4',
],
allowMultiple: true,
allowCompression: true,
withData: true,
withReadStream: true,
type: FileType.custom,
);
if (result != null) {
List<ChatMessage> newMessages = result.files.map((file) {
return ChatMessage(
user: user,
text: file.name,
medias: [
ChatMedia(
fileName: file.name,
type:
file.extension == 'mov' || file.extension == 'mp4'
? MediaType.video
: MediaType.image,
url: file.path!,
),
],
createdAt: DateTime.now(),
);
}).toList();
setState(() {
messages.insertAll(0, newMessages);
});
}
},
),
]
`
from dash-chat-2.
update! i was able to reproduce the bug in the example project as you can see in the attached video
Screen.Recording.2022-09-17.at.21.34.43.mov
the following is the add video button` [ IconButton( icon: Icon(Icons.attach_file), onPressed: () async { FilePickerResult? result = await FilePicker.platform.pickFiles( allowedExtensions: [ 'jpg', 'png', 'jpeg', 'mov', 'mp4', ], allowMultiple: true, allowCompression: true, withData: true, withReadStream: true, type: FileType.custom, );
if (result != null) { List<ChatMessage> newMessages = result.files.map((file) { return ChatMessage( user: user, text: file.name, medias: [ ChatMedia( fileName: file.name, type: file.extension == 'mov' || file.extension == 'mp4' ? MediaType.video : MediaType.image, url: file.path!, ), ], createdAt: DateTime.now(), ); }).toList(); setState(() { messages.insertAll(0, newMessages); }); } }, ), ]
`
Can you give me the full code of media.dart that you're using please?
from dash-chat-2.
import 'package:dash_chat_2/dash_chat_2.dart';
import 'package:examples/data.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
class Media extends StatefulWidget {
@override
_MediaState createState() => _MediaState();
}
class _MediaState extends State<Media> {
List<ChatMessage> messages = media;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Media example'),
),
body: DashChat(
currentUser: user,
inputOptions: InputOptions(
leading: [
IconButton(
icon: Icon(Icons.camera_alt),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
allowedExtensions: [
'jpg',
'png',
'jpeg',
'mov',
'mp4',
],
allowMultiple: true,
allowCompression: true,
withData: true,
withReadStream: true,
type: FileType.custom,
);
if (result != null) {
List<ChatMessage> newMessages = result.files.map((file) {
return ChatMessage(
user: user,
text: file.name,
medias: [
ChatMedia(
fileName: file.name,
type:
file.extension == 'mov' || file.extension == 'mp4'
? MediaType.video
: MediaType.image,
url: file.path!,
),
],
createdAt: DateTime.now(),
);
}).toList();
setState(() {
messages.insertAll(0, newMessages);
});
}
},
),
],
sendOnEnter: true,
),
onSend: (ChatMessage m) {
setState(() {
messages.insert(0, m);
});
},
messages: messages,
),
);
}
}
from dash-chat-2.
I was able to reproduce it and it should be fixed, I'll publish a new version
from dash-chat-2.
Related Issues (20)
- Fontsize Up HOT 6
- Unable to Implement Pagination with Scroll Listener in Dash Chat 2 HOT 3
- Multiline input doesn't expand HOT 1
- How to implement message copy on long press HOT 2
- Bump video_player dependence HOT 1
- Did dash_chat_2 0.0.20 supports sendbird_chat_sdk v4 ? HOT 2
- Custom component does not display chat messages behind it after setting transparency
- Wrong datetime HOT 1
- Documentation HOT 1
- How to enable image upload option HOT 1
- Conflict between cached_video_player and dash_chat_2 HOT 1
- Error while running Flutter project using package. HOT 1
- update intl to ^0.19.0 HOT 1
- ใHelpใHow do I get a user to always show an avatar in the chat list?
- Adding Reactions: Enhancement
- Use of arrow key to scroll chats HOT 3
- Please update to intl ^0.19.0 HOT 3
- Can't scroll using arrow keys after we tap on dashchat
- chat image not shown in chrome but safari
- Code Assist AI for developers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash-chat-2.