easy_cli 0.2.7 copy "easy_cli: ^0.2.7" to clipboard
easy_cli: ^0.2.7 copied to clipboard

CLI utility that generates a folder structure to reduce the repetitive work required to setup directories for models, services, repositories, screens and widgets.

Folder by Easy CLI Utility 📂 #

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 🔧 #

Make sure you are in the root of your project

easy generate -n <project_name>

Šī¸ 2022 Eren KARA

3
likes
110
pub points
0%
popularity

Publisher

unverified uploader

CLI utility that generates a folder structure to reduce the repetitive work required to setup directories for models, services, repositories, screens and widgets.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

BSD-3-Clause (LICENSE)

Dependencies

ansicolor, args, flutter, path, recase

More

Packages that depend on easy_cli