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