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

api_call_status_enum
app_button
app_card
app_checkbox
app_fonts
app_form
app_icon
app_icon.svg
app_localization_service
app_regex
app_slider
app_snackbar
app_strings
app_style
app_text_button
app_textformfield
app_widget_animator
auth_manager
base_service
base_state
base_stateless
base_viewmodel
cache_manager
dark_theme_color
dio_service
directory
easy_cli
en_us_translation
extension
files
generate
language
light_theme_color
logger
logs
model
product_model
product_service
product_state_view
product_stateless_view
product_viewmodel
sample
shared_pref
theme
tr_tr_translation