ui_router 2.0.5 copy "ui_router: ^2.0.5" to clipboard
ui_router: ^2.0.5 copied to clipboard

outdated

Simple Router for Pages, Dialogs, Loading tasks. Powerful functions, interfaces will support your app.

Header

Simple Router for Pages, Dialogs, Loading #

https://pub.dev/packages/ui_router

init #

// global

final router = UiRouter(
  pages: {
    '/a': (params) => PageA(),
    '/b': (params) => PageB(),
    '/c': (params) => PageC(),
  },
);

Widget #

UiRouterWidget(router)

(Widget usage sample) #

main() {
  final widget = UiRouterWidget(router);
  final app = MaterialApp(home: widget);
  runApp(app);
}

push (go to page B) #

router.push('/b');

pop (back one page) #

router.pop();

pop until the specific page #

router.pop(until: '/a');

current path stack #

router.pathStack

use path params #

pages: {
  '/a/:id': (params) => Page(params['id']),
},

... ...

router.push('/a/7'); // id=7

start with a root path #

final router = UiRouter(
  rootPath: '/b',
  ...
);

Dialog #

init #

final router = UiRouter(
  ...
  dialogs: {
    '/x': (call) => DialogX(call),
    '/y': (call) => DialogY(call),
  },
);

Open Dialog #

final call = router.open('/x');

Event on the Dialog #

call.event('USER-TAPPED-CANCEL');

Listen the event #

call.onEvent((value) {
  // value='USER-TAPPED-CANCEL'
});

Close Dialog #

router.close(call);

Loading #

show loading with a task #

router.loading(
  label: 'Now Loading...',
  task: () async {
    await Future.delayed(Duration(seconds: 5));
  },
);

😄 Using Navigator 2.0
🎉 Contributions, issues are welcomed!

0
likes
0
pub points
0%
popularity

Publisher

verified publisherflut.rbdog.biz

Simple Router for Pages, Dialogs, Loading tasks. Powerful functions, interfaces will support your app.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ui_router