chore: Follow up gallery picker
This commit is contained in:
parent
cc41a3bada
commit
eb446af438
3 changed files with 86 additions and 22 deletions
|
|
@ -522,8 +522,12 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
});
|
||||
}
|
||||
|
||||
void sendFileAction() async {
|
||||
final files = await selectFiles(context, allowMultiple: true);
|
||||
void sendFileAction({FileSelectorType type = FileSelectorType.any}) async {
|
||||
final files = await selectFiles(
|
||||
context,
|
||||
allowMultiple: true,
|
||||
type: type,
|
||||
);
|
||||
if (files.isEmpty) return;
|
||||
await showAdaptiveDialog(
|
||||
context: context,
|
||||
|
|
@ -547,23 +551,6 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
);
|
||||
}
|
||||
|
||||
void sendImageAction() async {
|
||||
final files = await ImagePicker().pickMultipleMedia(
|
||||
imageQuality: null,
|
||||
requestFullMetadata: false,
|
||||
);
|
||||
if (files.isEmpty) return;
|
||||
|
||||
await showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (c) => SendFileDialog(
|
||||
files: files,
|
||||
room: room,
|
||||
outerContext: context,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void openCameraAction() async {
|
||||
// Make sure the textfield is unfocused before opening the camera
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
|
|
@ -1139,7 +1126,10 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
sendFileAction();
|
||||
}
|
||||
if (choice == 'image') {
|
||||
sendImageAction();
|
||||
sendFileAction(type: FileSelectorType.images);
|
||||
}
|
||||
if (choice == 'video') {
|
||||
sendFileAction(type: FileSelectorType.videos);
|
||||
}
|
||||
if (choice == 'camera') {
|
||||
openCameraAction();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue