Flutter路由框架-airoute|爱路由


Airoute

totem


English Document 中文文档

我们的宗旨是:帮助开发者更加便利开发、切身体会编程之美!

airoute:

pub package

*1、支持无需context的路由管理,

*2、支持‘非侵入式参数传递’的路由管理,

*3、让你爱上路由管理的airoute

Airoute项目中的实战应用flutter sample

效果图

iOS Android
airoute_ios airoute_android
:- :-
macOS web
airoute_macos airoute_web
:- :-

1.安装

使用当前包作为依赖库

1. 依赖此库

在文件 ‘pubspec.yaml’ 中添加

pub package

dependencies:

  airoute: ^version

或以这种方式添加

# Route package.
airoute:
  git:
    url: https://github.com/pdliuw/airoute.git

2. 安装此库

你可以通过下面的命令行来安装此库

$ flutter pub get

你也可以通过项目开发工具通过可视化操作来执行上述步骤

3. 导入此库

现在,在你的Dart编辑代码中,你可以使用:

import 'package:airoute/airoute.dart';

2.使用

1.在你的项目入口’main.dart’中配置:

Airoute 全局配置

void main() {
  runApp(
    ///
    /// 配置Airoute
    Airoute.createMaterialApp(
      home: LaunchPage(),
      routes: <String, AirouteBuilder>{
        "/LaunchPage": () => LaunchPage(),
        "/SecondPage": () => SecondPage(),
      },
    ),
  );
}

2.调用/应用

*1、跳转新页面

Airoute.pushNamed(routeName: "/routeName");

*2、关闭页面

Airoute.pop();

*3、跳转新页面,并添加动画

Airoute.pushNamedWithAnimation(
    routeName: "/routeName",
    routePageAnimation: AirouteTransition.Slide);

*4、传递参数、接收参数

传递参数

Airoute.pushNamed(
  routeName: "/Page",
  argument: "遇见你,我很开心😄😄😄",
);

传递number参

Airoute.pushNamed(
  routeName: "/SecondPage",
  argument: 0
);

传递Map参数

Airoute.pushNamed(
  routeName: "/Page",
  argument: {
    "account":"this is accont",
    "password":"this is password ",
  },

传递Array参数

Airoute.pushNamed(
  routeName: "/Page",
  argument: [
    "Air",
    "James",
    "Lucy",
    "Tom",
  ],
);

接收参数

class Page extends StatefulWidget with AirArgumentReceiver {

  @override
  State<StatefulWidget> createState() {
    return _PageState();
  }

  @override
  void receive(AirArgument argument) {
    print("收到${argument.argument}参数了,我很开心😄😄😄");
  }
}

*4、更多用法点击,查看更多

LICENSE

Copyright 2019 pdliuw

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


   转载规则


《Flutter路由框架-airoute|爱路由》 Air 采用 知识共享署名 4.0 国际许可协议 进行许可。
  目录