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

outdated

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

example/main.dart

import 'package:flutter/material.dart';
import 'package:ui_router/ui_router.dart';

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

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

//
//  Page A
//
class PageA extends StatelessWidget {
  push() {
    router.push('/b');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Page A')),
      body: ElevatedButton(onPressed: push, child: Text('Push To B')),
    );
  }
}

//
//  Page B
//
class PageB extends StatelessWidget {
  pop() {
    router.pop();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Page B')),
      body: ElevatedButton(onPressed: pop, child: Text('Pop To A')),
    );
  }
}
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