一,整体路由配置
//整体路由配置
class Routers {
static Stringroot ='/';
//详情页面
static StringdetailsPage ='detail';
//方法写理由整体配置静态方法
static void configureRoutes(Router router) {
router.notFoundHandler =Handler(
// ignore: missing_return
handlerFunc: (BuildContext context, Map> params) {
//没有页面自行处理
print('ERROR===》ROUTE');
},
);
router.define(detailsPage, handler: detailsHandler);
}
}
二,生成静态文件
class Application{
static Routerrouter;
}
三,具体页面跳转
Handler detailsHandler =Handler(
handlerFunc: (BuildContext context, Map> params) {
String goodsId = params['id'].first;
print('index>details goodsId is ${goodsId}');
return DetailsPage(goodsId);
});
网友评论