Skip to content

Commit

Permalink
Merge pull request #160 from UsamaKarim/fix_image_picker_file_delete
Browse files Browse the repository at this point in the history
fix: deleting files with `deleteDialogBuilder`
  • Loading branch information
vasilich6107 authored Oct 6, 2024
2 parents 53e35d8 + 77052f2 commit 3cdcc82
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef PreprocessPickerError = Future<void> Function(

typedef DeleteDialogBuilder = Future<void> Function(
BuildContext context,
Function(SelectedFile file) onConfirm,
void Function() onConfirm,
);

typedef PopupDialogBuilder = Future<ImagePickerMode?> Function(
Expand Down Expand Up @@ -291,7 +291,7 @@ class ImagePickerWidget extends StatelessWidget {

if (mode != null) {
List<SelectedFile> result = await _onImageButtonPressed(context, mode);
if(result.isEmpty) {
if (result.isEmpty) {
return;
}

Expand Down Expand Up @@ -328,7 +328,9 @@ class ImagePickerWidget extends StatelessWidget {

void _handleDelete(BuildContext context, SelectedFile file) async {
if (deleteDialogBuilder != null) {
await deleteDialogBuilder?.call(context, _handleDeleteConfirm);
await deleteDialogBuilder?.call(context, () {
_handleDeleteConfirm(file);
});
return;
}

Expand Down

0 comments on commit 3cdcc82

Please sign in to comment.