rafidgotit / media_picker_widget

A widget that picks media files from storage and allows you to place anywhere in the widget tree.
MIT License
13 stars 14 forks source link

Weird behavior for MediaCount.single #7

Closed reliance-engineer closed 1 year ago

reliance-engineer commented 1 year ago

Hi again,

When using this configuration:

MediaPicker(
                mediaList: const [],
                onPicked: (e) => viewModel.selectMedia(e, context),
                onCancel: () {},
                mediaCount: MediaCount.single,
                mediaType: MediaType.all,
                decoration: PickerDecoration(
                  cancelIcon: const SizedBox.shrink(),
                  completeText: 'Select',
                  completeTextStyle: const TextStyle(
                    color: AppColors.textColorLight,
                  ),
                  completeButtonStyle: ElevatedButton.styleFrom(
                    backgroundColor: AppColors.accent,
                  ),
                ),
              ),

when the user clicks on one item it is selected, but if the user clicks in other item, instead of change the selection to the new item, both Items are selected but only one gets picked

In this image I have the card picture selected, and when I click other picture it gets marked but not selected

reliance-engineer commented 1 year ago

Also there is errors in the pub.dev documentation's code:

MediaPicker(
  mediaList: mediaList, //let MediaPicker know which medias are already selected by passing the previous mediaList
  onPick: (selectedList){.  /// <-- This is onPicked
    print('Got Media ${selectedList.length}');
  },
  onCancel: ()=> print('Canceled'),
  mediaCount: MediaCount.single,
  mediaType: MediaType.image,
  decoration: PickerDecoration(),
)
rafidgotit commented 1 year ago

Ah yes! Sorry for missing out the documentation code.

Let me find out the issue in single image picker, also album selector is overlaying your button

rafidgotit commented 1 year ago

hey @reliance-engineer , It has been solved in v1.0.2. Thank you for letting me know