Metro Cli tool
- Introduction
- Install
- Make Commands
- Appicons
Introduction
Metro is a CLI tool that works under the hood of the Nylo framework. It provides a lot of helpful tools to speed up development.
Install
Mac guide
- Open your bash_profile
sudo open ~/.bash_profile
- Add this alias to your bash_profile
...
alias metro='flutter pub run nylo_framework:main'
- Then run the following
source ~/.bash_profile
If you open a project that uses Nylo, try to run the following in the terminal.
metro
You should get an output similar to the below.
Metro - Nylo\'s Companion to Build Flutter apps by Anthony Gordon
Usage:
command [options] [arguments]
Options
-h
All commands:
project
project:init
make
make:controller
make:model
make:page
make:stateless_widget
make:stateful_widget
make:theme
appicons
appicons:build
Make controller
You can make a new controller by running the below in the terminal.
flutter pub run nylo_framework:main make:controller profile_controller
Or with the alias metro
metro make:controller profile_controller
This is will create a new controller if it doesn't exist within the app/controllers
directory.
Make model
You can make a new model by running the below in the terminal.
flutter pub run nylo_framework:main make:model product
Or with the alias metro
metro make:model product
This is will create a new model if it doesn't exist within the app/models
directory.
metro make:model product --storable
You can also make a Storable model which can be saved to the users local storage.
Learn more on Storable models here
Make page
You can make a new page by running the below in the terminal.
flutter pub run nylo_framework:main make:page product_page
Or with the alias metro
metro make:page product_page
This is will create a new page if it doesn't exist within the resources/pages/
directory.
Nylo also supports the use of controllers. Use the below command to create a new page with a controller.
metro make:page product_page -c
Create a page with a controller.
Make stateless widget
You can make a new stateless widget by running the below in the terminal.
flutter pub run nylo_framework:main make:stateless_widget product_rating_widget
Or with the alias metro
metro make:stateless_widget product_rating_widget
This is will create a new widget if it doesn't exist within the resources/widgets
directory.
Make stateful widget
You can make a new stateful widget by running the below in the terminal.
flutter pub run nylo_framework:main make:stateful_widget product_rating_widget
Or with the alias metro
metro make:stateful_widget product_rating_widget
This is will create a new widget if it doesn't exist within the resources/widgets
directory.
Make theme
You can make themes by running the below in the terminal.
flutter pub run nylo_framework:main make:theme bright_theme
Or with the alias metro
metro make:theme bright_theme
This is will create a new theme in resources/themes
.
Building app icons
You can generate all the app icons for IOS and Android by running the below command.
flutter pub run nylo_framework:main appicons:build
Or with the alias metro
metro appicons:build
This uses the pubspec.yaml configuration for your app icon. Check out the next section which explains how you can update your app icon in more detail.