Skip to content

Latest commit

 

History

History
277 lines (165 loc) · 5.06 KB

README_DETAIL-EN.md

File metadata and controls

277 lines (165 loc) · 5.06 KB

Airoute

totem


English Document 中文文档

Our aim is to help developers make development more convenient and experience the beauty of programming!

airoute:

pub package

*1、Support routing management without context

*2、Support 'non-intrusive parameter passing' routing management

*3、Airoute that makes you fall in love with routing management

Airoute in theProjectPractical applicationflutter sample

effect

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

1.Installation

Use the current package as a dependent library

1. Rely on this library

Add in file 'pubspec.yaml'

pub package


dependencies:

  airoute: ^version

or


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

2. Install this library

You can install this library via the command line below


$ flutter pub get


You can also perform the above steps through the visual operation through the project development tool

3. Import this library

Now, in your Dart editing code, you can use:


import 'package:airoute/airoute.dart';

2.Usage

1.Configure in your project entry 'main.dart':

Airoute Global configuration


void main() {
  runApp(
    ///
    /// Configuration Airoute
    Airoute.createMaterialApp(
      home: LaunchPage(),
      routes: <String, WidgetBuilder>{
        "/LaunchPage": (_) => LaunchPage(),
        "/SecondPage": (_) => SecondPage(),
      },
    ),
  );
}


2.Call / apply

*1、Jump to new page


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

*2、Close page


              Airoute.pop();

*3、Jump to new page and add animation


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

*4、Passing parameters, receiving parameters

Passing parameters


              Airoute.pushNamed(
                routeName: "/Page",
                argument: "I'm happy to meet you😄😄😄",
              );

Passing number parameters


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

Passing Map parameters

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

Passing Array parameters

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

Receiving parameters


class Page extends StatefulWidget with AirArgumentReceiver {

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

  @override
  void receive(AirArgument argument) {
    print("Received${argument.argument}parameters,I am happy😄😄😄");
  }
}


*5、Push route

pub package


          Airoute.push(
            route: AwesomeMessageRoute(
              awesomeMessage: AwesomeHelper.createAwesome(
                  title: "title", message: "message"),
              theme: null,
              settings: RouteSettings(name: "/messageRouteName"),
            ),
          );

*6、Jump to a new page and close the current page


              Airoute.pushReplacementNamed(
                routeName: "/routeName",
              );

*7、Jump to new page and close all previous pages


              Airoute.pushNamedAndRemoveUntil(
                newRouteName: "/routeName",
              );

*8、Jump to new page and close all previous pages except 'untilRouteName'


              Airoute.pushNamedAndRemoveUntil(
                newRouteName: "/routeName",
                untilRouteName: "/untilRouteName",
              );

LICENSE

BSD 3-Clause License

Copyright (c) 2020, pdliuw
All rights reserved.