Folder by Easy CLI Utility :open_file_folder:
A Dart CLI tool that generates the folder structure for the folder-by-feature pattern. This tool helps to reduce the repetitive work required to setup directories for models, services, repositories, screens and widgets.
How to use
dart pub global activate easy_cli
export PATH="$PATH":"$HOME/.pub-cache/bin"
flutter pub add easy_cli
easy generate -n <project_name>
Required flutter packages
Get,
Get Storage,
Dio,
Intl Phone Field,
Logger,
flutter_screenutil,
The folder structure generated by the cli is as follows:
core/
┣ constants/
┃ ┣ app_icon.dart
┃ ┣ app_icon.svg.dart
┃ ┗ app_regex.dart
┣ init/
┃ ┣ service/
┃ ┃ ┣ base_service.dart
┃ ┃ ┗ dio_service.dart
┃ ┣ view
┃ ┃ ┣ base
┃ ┃ ┃ ┣ base_state.dart
┃ ┃ ┃ ┗ base_stateless.dart
┃ ┃ ┣ theme
┃ ┃ ┃ ┗ theme.dart
┃ ┃ ┣ widget
┃ ┃ ┃ ┣ button
┃ ┃ ┃ ┣ card
┃ ┃ ┃ ┣ checkbox
┃ ┃ ┃ ┣ form
┃ ┃ ┃ ┣ slider
┃ ┃ ┃ ┣ textformfield
┃ ┣ viewmodel
┃ ┃ ┗ base_viewmodel.dart
┣ manager/
┃ ┣ auth/
┣ ┣ auth_manager.dart
┃ ┃
┃ ┣ cache/
┣ ┗ cache_manager.dart
┣ extension/
┃ ┗ base_extension.dart
┣ language/
┃ ┗ base_language.dart
┣ model/
┗ ┗ base_model.dart
feature/
┣ components/
┃ ┗ button
product/
┣ model/
┃ ┗ product_model.dart
┣ service/
┃ ┗ product_service.dart
┣ view/
┣ ┣ product_state_view.dart
┣ ┗ product_stateless_view.dart
┣ viewmodel/
┃ ┗ product_viewmodel.dart
Example main.dart
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'core/manager/cache/shared_pref.dart';
import 'app/routes/app_pages.dart';
import 'config/theme/my_theme.dart';
import 'config/translations/localization_service.dart';
Future<void> main() async {
// wait for bindings
WidgetsFlutterBinding.ensureInitialized();
// init shared preference
await MySharedPref.init();
runApp(
ScreenUtilInit(
// xd art board size
designSize: const Size(375, 812),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, widget) {
return GetMaterialApp(
title: "GetXSkeleton",
useInheritedMediaQuery: true,
debugShowCheckedModeBanner: false,
builder: (context,widget) {
bool themeIsLight = MySharedPref.getThemeIsLight();
return Theme(
data: MyTheme.getThemeData(isLight: themeIsLight),
child: MediaQuery(
// prevent font from scalling (some people use big/small device fonts)
// but we want our app font to still the same and dont get affected
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget!,
),
);
},
initialRoute: AppPages.INITIAL, // first screen to show when app is running
getPages: AppPages.routes, // app screens
locale: MySharedPref.getCurrentLocal(), // app language
translations: LocalizationService(), // localization services in app (controller app language)
);
},
),
);
}
Command Usage :wrench:
Make sure you are in the root of your project
easy generate -n <project_name>
:copyright: 2022 Eren KARA
Libraries
- commands/generate
- easy_cli
- samples/implementations/core/config/app_localization_service
- samples/implementations/core/config/app_strings
- samples/implementations/core/config/en_US/en_us_translation
- samples/implementations/core/config/tr_TR/tr_tr_translation
- samples/implementations/core/constants/app_icon
- samples/implementations/core/constants/app_icon.svg
- samples/implementations/core/constants/app_regex
- samples/implementations/core/constants/enum/api_call_status_enum
- samples/implementations/core/extension
- samples/implementations/core/init/service/base_service
- samples/implementations/core/init/service/dio_service
- samples/implementations/core/init/view/base/base_state
- samples/implementations/core/init/view/base/base_stateless
- samples/implementations/core/init/view/theme/app_fonts
- samples/implementations/core/init/view/theme/app_style
- samples/implementations/core/init/view/theme/dark_theme_color
- samples/implementations/core/init/view/theme/light_theme_color
- samples/implementations/core/init/view/theme/theme
- samples/implementations/core/init/view/widget/animator/app_widget_animator
- samples/implementations/core/init/view/widget/card/app_card
- samples/implementations/core/init/view/widget/checkbox/app_checkbox
- samples/implementations/core/init/view/widget/form/app_form
- samples/implementations/core/init/view/widget/slider/app_slider
- samples/implementations/core/init/view/widget/sncakbar/app_snackbar
- samples/implementations/core/init/view/widget/textformfield/app_textformfield
- samples/implementations/core/init/viewmodel/base_viewmodel
- samples/implementations/core/language
- samples/implementations/core/logger
- samples/implementations/core/manager/auth/auth_manager
- samples/implementations/core/manager/cache/cache_manager
- samples/implementations/core/model
- samples/implementations/product/model/product_model
- samples/implementations/product/service/product_service
- samples/implementations/product/view/product_state_view
- samples/implementations/product/view/product_stateless_view
- samples/implementations/product/viewmodel/product_viewmodel
- samples/sample
- utils/directory
- utils/files
- utils/logs