solved pr comments; picking multiple Images from Gallery is now possible
This commit is contained in:
parent
d8c72a5d28
commit
cf4dea566e
@ -219,8 +219,8 @@ class _FilesState extends State<Files> {
|
||||
leading: const Icon(Icons.add_a_photo_outlined),
|
||||
title: const Text('Aus Gallerie hochladen'),
|
||||
onTap: () {
|
||||
FilePick.galleryPick().then((value) {
|
||||
if(value != null) mediaUpload([value.path]);
|
||||
FilePick.multipleGalleryPick().then((value) {
|
||||
if(value != null) mediaUpload(value.map((e) => e.path).toList());
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
@ -170,7 +170,6 @@ class _FilesUploadDialogState extends State<FilesUploadDialog> {
|
||||
);
|
||||
|
||||
if(uploadTask.statusCode < 200 || uploadTask.statusCode > 299) {
|
||||
// error code
|
||||
setState(() {
|
||||
_isUploading = false;
|
||||
_overallProgressValue = 0.0;
|
||||
@ -241,7 +240,7 @@ class _FilesUploadDialogState extends State<FilesUploadDialog> {
|
||||
value: currentFile._uploadProgress,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(2)),
|
||||
) : null,
|
||||
leading: Container(
|
||||
trailing: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
padding: EdgeInsets.zero,
|
||||
@ -256,23 +255,6 @@ class _FilesUploadDialogState extends State<FilesUploadDialog> {
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
),
|
||||
),
|
||||
trailing: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
padding: EdgeInsets.zero,
|
||||
child: IconButton(
|
||||
tooltip: 'Namen löschen',
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
if(!_isUploading) {
|
||||
setState(() {
|
||||
currentFile.fileName = '';
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
),
|
||||
),
|
||||
|
@ -111,8 +111,8 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
leading: const Icon(Icons.image),
|
||||
title: const Text('Aus Gallerie auswählen'),
|
||||
onTap: () {
|
||||
FilePick.galleryPick().then((value) {
|
||||
if(value != null) mediaUpload([value.path]);
|
||||
FilePick.multipleGalleryPick().then((value) {
|
||||
if(value != null) mediaUpload(value.map((e) => e.path).toList());
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
@ -13,6 +13,14 @@ class FilePick {
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<List<XFile>?> multipleGalleryPick() async {
|
||||
final pickedImages = await _picker.pickMultiImage();
|
||||
if(pickedImages.isNotEmpty) {
|
||||
return pickedImages;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<List<String>?> documentPick() async {
|
||||
var result = await FilePicker.platform.pickFiles(allowMultiple: true);
|
||||
var paths = result?.files.nonNulls.map((e) => e.path).toList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user