当前位置:   article > 正文

Flutter之Fluro_flutter fluro

flutter fluro

1、首先引入fluro

2、新建一个文件夹命名为routes(此文件夹可随意命名),并在文件夹中新建文件application.dart

  1. import 'package:fluro/fluro.dart';
  2. class Application {
  3. static Router router;
  4. }

3、在routes文件夹下新建文件routes.dart(命名路由并)

  1. import 'package:flutter/material.dart';
  2. import 'package:fluro/fluro.dart';
  3. import './router_handler.dart';
  4. class Routes {
  5. static String root = '/';
  6. static String indexPage = '/index';
  7. static String categoryPage = '/category/:id';
  8. static String cartPage = '/cart';
  9. static String memberPage = '/member';
  10. static String homePage = '/home';
  11. static void configureRoutes(Router router) {
  12. router.notFoundHandler = new Handler(
  13. handlerFunc: (BuildContext context, Map<String, List<String>> params) {
  14. print('Error====>ROUTE WAS NOT FOUND');
  15. print ('找不到路由,404');
  16. return;
  17. }
  18. );
  19. router.define(indexPage, handler: indexPageHandler); // 路由处理方法
  20. router.define(categoryPage, handler: categoryPageHa
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/874399
推荐阅读
相关标签
  

闽ICP备14008679号