Folder structure can come in many ways, the default way for parabeac_core is Domain-based architecture
. Folder structuring was implemented thinking on extending the types of folder structure, so we can let the user decide the structure they want to use.
For some projects is good to keep related services and files under their own domain. For example, if our project includes, User Authentication
, Update User Information
, and Create User
, all these files and services should belong under User
which it would be our domain to store everything user related.
This can help us to keep in mind that our app should be divided into individual modules that we should be able to interchange at anytime without breaking anything.
Take the following Figma & VSCode screenshots:
We can see that on our Figma file we have 4 pages, which are hiro/mobile
, autoLayoutPermutations
, hiro/desktop
and components
.
As we can observe on the VS Code output, the only page containing screens is hiro/mobile
that is the reason it is inside views/
but if we see widgets/
we will see that hiro/mobile
and components
are directories on it because they have regular widgets and/or custom widgets. If we pay closely attention, we can noticed that autoLayoutPermutations
nor hiro/desktop
have a directory under their name. That is because they do not have any screens and/or widget under them, so we skip them.
As we can appreciate, it is following the next structure, (provided by Ivan V)
lib/
|____ views/
| |____ login/
| |____ home/
| |____ settings/
|____ bloc/ => We do not generate this, just a sample folder
| |____ login/
| |____ home/
| |____ settings/
|____ widgets/
|____ login/
| |____ custom/
| | |____ scrollview_custom.dart
| |____ my_component.g.dart
|____ home/
|____ settings/
In the example above we can see that views
, bloc
, and widgets
are our domain models, and it can happen that inside our models we will have more models which is the case for widgets
which also includes models for the different pages/
that our Figma file may have, and inside those model pages we have custom
widgets inside the custom/
folder and regular widgets that are at the root of widgets/<respective_page>