slidy 1.2.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

Pub GitHub stars Telegram

Actions Status Actions Status Actions Status Actions Status Actions Status

Acesse a documentação em Português-Brasil

Slidy #

CLI package manager and template generator for Flutter. Generate Modules, Pages, Widgets, BLoCs, Controllers and tests.

Slidy supports rxBLoC, flutter_bloc and mobx.

Why should I use? #

Slidy's goal is to help you structure your project in a standardized way. Organizing your app in Modules formed by pages, repositories, widgets, BloCs, and also create unit tests automatically. The Module gives you a easier way to inject dependencies and blocs, including automatic dispose. Also helps you installing the dependencies and packages, updating and removing them. The best is that you can do all of this running a single command.

Motivations #

We realized that the project pattern absence is affecting the productivity of most developers, so we're proposing a development pattern along with a tool that imitates NPM (NodeJS) functionality as well as template generation capabilities (similar to Scaffold ).

About the Proposed Pattern #

The structure that slidy offers you, it's similar to MVC, where a page keeps it's own business logic classes(BloC).

We recommend you to use bloc_pattern when structuring with slidy. It offers you the module structure(extending the ModuleWidget) and dependency/bloc injection, or you will probably get an error.

To understand bloc_pattern package, take a look at the README.

We also use the Repository Pattern, so the folder structure it's organized in local modules and a global module. The dependencies(repositories, BloCs, models, etc) can be accessed throughout the application.

Sample folder structure generated by slidy:

Folder example

Installation #

  1. Activate the slidy using the pub: flutter pub global activate slidy
  2. Type slidy --version to make sure everything is working properly. This command should return the installed version.

Commands: #

upgrade: #

Updates slidy's version:

slidy upgrade

start: #

Create the basic structure of your project (make sure that your "lib" folder it's empty).

slidy start //default
slidy start --flutter_bloc
slidy start --mobx

If you have the flutter_bloc or flutter_mobx package in pubspec, the generation of pages, widgets, and bloc defaults to the installed manager default.

Folder example

run: #

Runs the scripts in pubspec.yaml:

slidy run open_folder

Folder example

install: #

Installs or update the packages in dependencies:

Folder example

slidy install rxdart dio bloc_pattern

or you can just use the i command (both are the same)

slidy i rxdart dio bloc_pattern

Install packages as dev_dependency:

slidy i mockito --dev

Folder example

uninstall: #

Removes a package

 slidy uninstall dio 

You can also remove a dev_dependency using the flag --dev

generate: #

Creates a module, page, widget or repository including its BloC class.

NOTE: You can replace "g" with "generate" command.

Creates a new module:

slidy g module folder_name

Folder example

Creates a new page + BloC:

slidy g page folder_name/pages

Creates a new widget + BloC:

slidy g widget folder_name/widgets

NOTE: You can create a page or widget using its respective BLoC using the flag -b

Create a new repository

slidy g r folder_name/repositories

Create a new model

slidy g mm folder_name/model

You can also use "repository" in "r"'s place, but it will have the same function.

Folder example

Unit Tests: #

Generate unit tests on the test folder for you.

slidy test folder_name/

Common errors: #

Windows:

Folder example

If you got this error when trying to run the pub global activate slidy, then you will have to set the environment variables manually:

  • In windows search, write: Edit System Variables

Folder example

  • Then click at Environment Variables

Folder example

  • Go to Path

Folder example

  • Then click in New and add the path that appeared on your console.

Folder example

If you have any doubt about setting up the system variables, watch this video.

For more details join our Telegram Group Flutterando

1.2.2 #

  • Added command generate model

1.2.1 #

  • Fix error install in flutter dart.
  • removed dart:mirrors.

1.2.0+1 #

  • Added flutter_bloc and mobx support.
  slidy start --flutter_bloc [-f]
  or
  slidy start --mobx [-m]

If you have the flutter_bloc or flutter_mobx package in pubspec, the generation of pages, widgets, and bloc defaults to the installed manager default.

  • Added flags "--flutter_bloc | -f" and "--mobx | -m" to generate bloc.
  • Added command "generate controller" (to mobx).

1.1.4 #

  • Added initModule in tests (check the documentation)

1.1.3 #

  • Create unity test widget when generate pages or widgets.
  • Flutter Dart 100% compatible
     flutter pub global activate slidy
    

1.1.2 #

  • Added "service" command to generate auto disposed and injetable service.
     slidy generate service path-of-your-file
    

1.1.0 #

  • Now creating BLoCs or Repositories also creates Unitary Test files.
  • Added "test" command to "generate command".
     slidy generate test path-of-your-file
    

1.0.0 #

  • added command run, for exec your scripts in pubspec.yaml
  • Some commands have been improved for ease of usability for example the module, page and widget generation command have been shortened.
  • Fix errors

0.2.1 #

  • Removed folder App for main module.
  • File placement changes after "start -c" command.
  • The command "start -c" is being optimized to be the initial interface. We are working on the routes.

0.2.0 #

  • Added start -c, to start the project with routers, locations, and page structures

0.1.2 #

  • Added bloc command create;

0.1.1 #

  • Added param 'create';

0.0.1 #

  • Initial version, created by Stagehand

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate slidy

2. Use it

The package has the following executables:


$ slidy

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  slidy: ^1.2.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:slidy/slidy.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4

Health suggestions

Fix lib/src/modules/version.dart. (-0.50 points)

Analysis of lib/src/modules/version.dart reported 1 hint:

line 1 col 8: Unused import: 'package:slidy/src/utils/utils.dart'.

Format lib/slidy.dart.

Run dartfmt to format lib/slidy.dart.

Format lib/src/command/create_command.dart.

Run dartfmt to format lib/src/command/create_command.dart.

Fix additional 12 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/command/start_command.dart (Run dartfmt to format lib/src/command/start_command.dart.)
  • lib/src/command/sub_command/generate_bloc.dart (Run dartfmt to format lib/src/command/sub_command/generate_bloc.dart.)
  • lib/src/command/sub_command/generate_model_sub_command.dart (Run dartfmt to format lib/src/command/sub_command/generate_model_sub_command.dart.)
  • lib/src/command/sub_command/generate_page_sub_command.dart (Run dartfmt to format lib/src/command/sub_command/generate_page_sub_command.dart.)
  • lib/src/command/sub_command/generate_repository_sub_command.dart (Run dartfmt to format lib/src/command/sub_command/generate_repository_sub_command.dart.)
  • lib/src/command/sub_command/generate_service_sub_command.dart (Run dartfmt to format lib/src/command/sub_command/generate_service_sub_command.dart.)
  • lib/src/command/sub_command/generate_widget_sub_command.dart (Run dartfmt to format lib/src/command/sub_command/generate_widget_sub_command.dart.)
  • lib/src/modules/generate.dart (Run dartfmt to format lib/src/modules/generate.dart.)
  • lib/src/modules/run.dart (Run dartfmt to format lib/src/modules/run.dart.)
  • lib/src/templates/generator/widget_test_generator.dart (Run dartfmt to format lib/src/templates/generator/widget_test_generator.dart.)
  • lib/src/utils/file_utils.dart (Run dartfmt to format lib/src/utils/file_utils.dart.)
  • lib/src/utils/output_utils.dart (Run dartfmt to format lib/src/utils/output_utils.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
ansicolor ^1.0.2 1.0.2
args ^1.5.2 1.5.2
http ^0.12.0+2 0.12.0+2
path ^1.6.2 1.6.4
yaml ^2.1.16 2.2.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
pedantic 1.9.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.9.4