Last updated:
0 purchases
eticon struct
ETICON Struct #
A package specifically for creating a project structure and individual elements.
Installation into a project #
Add eticon_struct: 1.0.0 to dev_dependencies pubspec.yaml as shown below:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
eticon_struct: ^1.0.0
copied to clipboard
Project structure #
The project structure looks like this:
├── 📁 assets
│ ├── 📁 fonts
│ │ └── 📄 empty.ttf
│ ├── 📁 icons
│ │ └── 🖼 empty.png
│ └── 📁 images
│ └── 🖼 empty.png
└── 📁 lib
├── 📄 main.dart
├── 📁 models
│ └── 📄 about_models.txt
├── 📁 project_utils
│ ├── 📄 pj_colors.dart
│ ├── 📄 pj_icons.dart
│ └── 📄 pj_utils.dart
├── 📁 project_widgets
│ ├── 📄 pj_appbar.dart
│ ├── 📄 pj_text.dart
│ └── 📄 pj_widgets.dart
└── 📁 screens
└── 📁 main_screen
├── 📁 cubit
│ ├── 📄 cb_main_screen.dart
│ └── 📄 st_main_screen.dart
├── 📄 main_screen.dart
└── 📄 main_screen_provider.dart
copied to clipboard
Creating a project structure #
In order to create the structure described above, after a new flutter project has been created,
execute command in terminal:
flutter pub run eticon_struct:create
copied to clipboard
Basically created:
Utilities of the project.
Global widgets.
Assets.
Folder for models.
Basic Stateless screen with a cubit connected to it for managing states.
A set of basic libraries is also added to the project:
eticon_api
get
flutter_screenutil
flutter_bloc
flutter_svg
get_storage
intl
sentry_flutter
If you want to create a basic screen without a qubit, then use the special flag --without-cubit:
flutter pub run eticon_struct:create --without-cubit
copied to clipboard
If you want to create a basic screen as a Stateful Widget, then use the special flag --stf
flutter pub run eticon_struct:create --stf
copied to clipboard
You can also use these two flags at the same time:
flutter pub run eticon_struct:create --stf --without-cubit
copied to clipboard
Creating new screens in the project #
You can create new screens in a project using a special command:
flutter pub run eticon_struct:screen --name=<file_name>
copied to clipboard
Example:
flutter pub run eticon_struct:screen --name=new
copied to clipboard
After executing this command, a new screen will be added to the project: new_screen.
NOTE!!!
The name is specified in the same way as files are named in Dart, that is, using _ as a word separator.
Do not add "screen" at the end, it happens automatically when the screen is created!
Similar to creating the project structure, you can use the flags: --stf (to create a screen as a Stateful Widget)
and --without-cubit (to create the screen without cubit).
Example:
flutter pub run eticon_struct:screen --name=order_schedule --stf --without-cubit
copied to clipboard
Creating new Cubits not tied to a specific screen #
You can create new cubits not tied to a specific screen:
flutter pub run eticon_struct:cubit --name=<file_name> --path=<your_path>
copied to clipboard
Example:
flutter pub run eticon_struct:cubit --name=my_cubit --path=project_utils
copied to clipboard
After executing this command, a new cubit will be added to the project_utils directory: my_cubit.
NOTE!!!
The name is specified in the same way as files are named in Dart, that is, using _ as a word separator.
path is the directory where the new cubit will be created, keep in mind that path is substituted into the following line:
lib /
Creating Singletons #
You can create singleton using the command:
flutter pub run eticon_struct:singleton --name=<file_name>
copied to clipboard
Example:
flutter pub run eticon_struct:singleton --name=my_settings
copied to clipboard
After executing this command, a new directory, singletons, will appear in project_utils, which will contain
all singleton you created.
Result of the created singleton:
class SgMySettings {
SgMySettings._();
static SgMySettings instance = SgMySettings._();
static int cnt = 0; //some variables
//Some Method
void inc(){
cnt++;
}
}
copied to clipboard
This class will be automatically added to project_utils.dart.
Contacts #
If you still have questions or have any suggestions to improve this package.
You can contact us by mail: [email protected]
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.