路由,用来push的地址和传递参数的routers
1:引入对应控制器或者类的地址
import 'package:flutter/material.dart';
import 'package:machine_pro/main_menu/TabBarViewController.dart';
import 'package:machine_pro/UIKit/UILabelViewController.dart';
import 'package:machine_pro/UIKit/UIButtonViewController.dart';
2:正文路由代码
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: TabBarViewController(),
routes: <String, WidgetBuilder>{
// 这里就是我们要定义的路由了
'/label': (BuildContext context) => new UILabelViewController("UILabel"),
'/button': (BuildContext context) => new UIButtonViewController(),
},
);
}
}
Flutter配置for Mac -- VSCode
Flutter入门基础(一)-Label
Flutter入门基础(二)-Button
Flutter入门基础(三)-TextFile登录页
Flutter入门基础(四)-imageview
Flutter入门基础(五)-UITableView
Flutter入门基础(六)-UITableView(二)添加headerView
Flutter入门基础(七)-路由
Flutter入门基础(八)-push页面跳转
- 如有问题可添加QQ群:234812704
- 欢迎各位一块学习,提高逼格!
- 也可以添加洲洲哥的微信公众号
可以来微信公众号(洲洲哥)后台给我留言。 快来扫码关注我们吧!
公众号二维码
网友评论