crouter 0.1.0 crouter: ^0.1.0 copied to clipboard
A sample command-line application.
crouter使用方法 #
使用方法 #
添加引用到需要使用注解packages的dev_dependencies中
- 使用本地库
crouter:
path: crouter
- 使用github库
crouter:
git:
url: https://github.com/chengbook/crouter.git
ref: v0.1.0
- 使用pub
crouter: ^0.1.0
添加注解
@CRouter('example/test1')
class Test1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
激活crouter命令行工具
///github 使用方式 执行完pub get 后,github上的项目存放在 flutter sdk -> .pub-cache ->git -> crouter
pub global activate --source path <crouter path>
///上传到pub.dev后,使用此命令
pub global activate crouter
执行命令
在项目根目录下执行命令
crouter
- 在项目的lib/src生成路由列表
- 在项目根目录下生成packages,名字为app_router,作用是存放所有页面的路由名称
- 每个module中的所有页面存放在一个和module名称对应的类中,如果module包含'_',则类名如下: app_router -> AppRouter