赞
踩
1、首先引入fluro
2、新建一个文件夹命名为routes(此文件夹可随意命名),并在文件夹中新建文件application.dart
- import 'package:fluro/fluro.dart';
- class Application {
- static Router router;
- }
3、在routes文件夹下新建文件routes.dart(命名路由并)
- import 'package:flutter/material.dart';
- import 'package:fluro/fluro.dart';
- import './router_handler.dart';
- class Routes {
- static String root = '/';
- static String indexPage = '/index';
- static String categoryPage = '/category/:id';
- static String cartPage = '/cart';
- static String memberPage = '/member';
- static String homePage = '/home';
-
- static void configureRoutes(Router router) {
- router.notFoundHandler = new Handler(
- handlerFunc: (BuildContext context, Map<String, List<String>> params) {
- print('Error====>ROUTE WAS NOT FOUND');
- print ('找不到路由,404');
- return;
- }
- );
- router.define(indexPage, handler: indexPageHandler); // 路由处理方法
- router.define(categoryPage, handler: categoryPageHa
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。