Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup file and folder organization #6

Open
adrian-szwejk opened this issue Jun 26, 2023 · 5 comments
Open

Cleanup file and folder organization #6

adrian-szwejk opened this issue Jun 26, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed priority: high describes the immediacy of attention required

Comments

@adrian-szwejk
Copy link
Contributor

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.

@adrian-szwejk adrian-szwejk added enhancement New feature or request help wanted Extra attention is needed priority: high describes the immediacy of attention required labels Jun 26, 2023
@ashah305
Copy link
Contributor

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

@ashah305
Copy link
Contributor

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

@adrian-szwejk
Copy link
Contributor Author

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 adrian-szwejk pinned this issue Jun 27, 2023
@adrian-szwejk
Copy link
Contributor Author

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed priority: high describes the immediacy of attention required
Projects
None yet
Development

No branches or pull requests

2 participants