FileUploader issue with limit=1
Closed this issue · 2 comments
Hi ! Thanks for your work on this useful Widget.
Steps to reproduce the issue:
- FileUploader (limit: 1 [...]
- In the GUI, add a file
- Remove the uploaded file by clicking the bin
- Here we are => impossible to add a new file, because the zone is disabled.
It's a problem between the model and the _Selector : you have to take into account the _controllers.map() size compared with the limit in your _Selector attributes.
Maybe something like in FileUploaderModel
dynamic get isOverLimit => _controllers.size() > limit
And in ui.dart:
selector: (context, model) => (model.processingFiles, model.errorOnFiles, model.isOverLimit)
And, somehow, update the version when you update the code. But that's not the problem :-)
Thank you for the feedback!
I will look into what you pointed out this weekend and update the package accordingly.
The issue was actually between the UI and the selector, which wasn't reacting to changes in the controllers. To explicitly declare the dependency in the selector, I should have included the onPressedAddFiles function, which has additional dependencies inside it. Instead, I decided to use a Consumer in the button rather than a Selector.