oi-narendra / multiselect-dropdown

Streamlined Flutter widget for versatile multi-selection with extensive customization.
https://pub.dev/packages/multi_dropdown
GNU General Public License v3.0
74 stars 84 forks source link

[Draft] Refractoring #80

Closed rickypid closed 4 months ago

rickypid commented 8 months ago

Hello @oi-narendra,

First of all, thank you for your contribution to the Flutter community and for this package.

I suggest you propose this PR. I hope I am not being too substantial in the changes, but I would like to ask you some questions that this PR aims to address.

  1. Your MultiSelectDropDown.network constructor poses a significant limitation on retrieving information from a backend. Consider if one wanted to use this package with data coming from a SQLite database. The method that retrieves data with an http call would not work since it is extremely tied to an http call. Another example is if I wanted to select users from a list of thousands of users, I would be forced to make a call to download them all and then search on the client side, which would be impossible to do if the number grew. If I wanted to filter them, I would have no way to do so on the server side. This PR implements a method of asynchronously retrieving data with the ability to interface with any data source and to perform searches on the server side. Lastly, it removes the dependency on the http package, as not all projects may want to depend on that package.
  2. I have removed the ValueItem class, now the label of an option is the T.toString() class, if you want to customize the displayed text you can use the optionAsString parameter that allows you to customize the displayed label.
  3. I have changed the structure of the project so that it is clearer and easier to read.
  4. I have implemented some flutter_lints rules in order to have a more consistent structure.
  5. I have added a GitHub workflow in order to validate the code formatting and analysis before approving a new PR.

Overall, there are other minor changes that I will finish documenting as soon as you confirm that you agree to go this way.

It is a fairly important Refactoring that will create breaking changes; therefore, it will need to be carefully verified before releasing.

I await your feedback.

hbatalhaStch commented 8 months ago

@rickypid from your description and a quick glimpse at the code it looks like the changes will make this package even better. If @oi-narendra agrees to go this way I will close #76 in favor of this.

One thing though, when committing, that I think that you could've done better is regarding the file lib/multiselect_dropdown. A better way to handle it would be to first git mv it into lib/src/multiselect_dropdown and then creating a new file lib/multiselect_dropdown. This way we wouldn't lose the history of the file and we could git diff precisely the changes you've made. Because right now is impossible to pinpoint all the changes since lib/src/multiselect_dropdown is a whole new file to git.

rickypid commented 8 months ago

@hbatalhaStch seems like a great tip for keeping history!! Thank you, we are waiting for @oi-narendra to continue. If he approves I have to spend some time finishing the documentation.

rickypid commented 8 months ago

@rickypid from your description and a quick glimpse at the code it looks like the changes will make this package even better. If @oi-narendra agrees to go this way I will close #76 in favor of this.

One thing though, when committing, that I think that you could've done better is regarding the file lib/multiselect_dropdown. A better way to handle it would be to first git mv it into lib/src/multiselect_dropdown and then creating a new file lib/multiselect_dropdown. This way we wouldn't lose the history of the file and we could git diff precisely the changes you've made. Because right now is impossible to pinpoint all the changes since lib/src/multiselect_dropdown is a whole new file to git.

@hbatalhaStch Doing git mv works until I create the new file with the same name, at which point git thinks it's just been modified, I've never done this while also keeping the original file. It can be done?

hbatalhaStch commented 8 months ago

@rickypid you will have to start from scratch, create a new branch and make the commits again. Close this PR and open a new one.

Another option is to undo the commits in this branch, commit again and then and git push -f

rickypid commented 8 months ago

@oi-narendra do you have any news on this? 😄

rickypid commented 5 months ago

@oi-narendra Sorry for the insistence but I would need to understand if you are going to continue or not 😄

oi-narendra commented 4 months ago

Migrate to the latest version v3.0.0. The package has been refactored. Thank you for your contribution.