SiGMobileUIUC / car_pool_app

1 stars 0 forks source link

Cleanup file and folder organization #6

Open adrian-szwejk opened 1 year ago

adrian-szwejk commented 1 year ago

The files in the screens folder are very long and contain many functions that could be moved into seperate files and folders to oragnized more and follow clean architecture (https://felipeemidio.medium.com/folder-structure-for-flutter-with-clean-architecture-how-i-do-bbe29225774f). If that's too much to do, at least organize per screen folder with function/variable files.

ashah305 commented 1 year ago

Wait, what do you mean by organize per screen folder with function / variable files?

ashah305 commented 1 year ago

Like do you mean have sub folders that have the code for like each function?

adrian-szwejk commented 1 year ago

So you usually want to split up the logic and the UI components of flutter apps into two or more different files (Depending on how many classes/widgets you have). An example that I see in account.dart would be all the "editRole, editBio, editPassword" functions that could be condensed into a function with a controller and hintText parameter, on top of that you could move that function as well as the "_pickImageFromGallery()" into a account_functions.dart or account_constants.dart if that's what you'd choose to name it. Ideally we'd use blocs (https://pub.dev/packages/flutter_bloc) and very good cli (https://cli.vgv.dev/) to organize all this but for now I'd recommend reading into clean architecture (https://felipeemidio.medium.com/folder-structure-for-flutter-with-clean-architecture-how-i-do-bbe29225774f) and try to implement some of the overall structure organization of what things (widgets, logic, variables, classes, etc) should be placed under what folder. Kind of like this part of the article. image

adrian-szwejk commented 1 year ago

And to start off you could just organize the screens into sub-folders of each screenm.Like an account folder with the account_page.dart and account_functions.dart or however you can name them however you like but keep it consistent.

ashah305 commented 1 year ago

Okay sounds good - thanks. i will try to get started this week on that