mrouter 0.1.0 copy "mrouter: ^0.1.0" to clipboard
mrouter: ^0.1.0 copied to clipboard

A miniature flutter router that supports widget area division, carries query parameters.

example/main.dart

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

void main() => runApp(MaterialApp(
      home: App(),
    ));

class App extends StatefulWidget {
  @override
  _AppState createState() => _AppState();
}

class _AppState extends State<App> {
  /// [MRouter]: Instantiate the router
  var router = MRouter({'/profile': Text('profile'), '/': Text('home')});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
      child: Column(
        children: [
          Row(
            children: [
              /// [router.toSwitch(this, 'route-path')] controls routing jump

              IconButton(
                  icon: Icon(Icons.home_rounded),
                  onPressed: () => router.toSwitch(this, '/')),
              IconButton(
                  icon: Icon(Icons.info_rounded),
                  onPressed: () => router.toSwitch(this, '/profile')),
            ],
          ),

          /// [router.view()] is converted to the corresponding routing view
          router.view(),
        ],
      ),
    ));
  }
}
0
likes
150
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

A miniature flutter router that supports widget area division, carries query parameters.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on mrouter