route_stack_manager 0.1.5 copy "route_stack_manager: ^0.1.5" to clipboard
route_stack_manager: ^0.1.5 copied to clipboard

This is a Flutter route stack information listening library. You can obtain the list of current routes, current routes, previous routes, and whether the current route is a pop-up window

example/lib/main.dart

import 'package:example/page/page_one.dart';
import 'package:flutter/material.dart';
import 'package:route_stack_manager/route_stack_manager.dart';

void main() {
  RouteManager().isDebug = true;
  RouteManager().filterRoute = (route) => true;

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      navigatorObservers: [
        RouteManagerObserver(),
      ],
      theme: buildTheme(),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }

  ThemeData? buildTheme() {
    const primary = Colors.blue;
    return ThemeData(
      primarySwatch: primary,
      colorScheme: ColorScheme.fromSeed(seedColor: primary),
      useMaterial3: true,
      appBarTheme: const AppBarTheme(
        backgroundColor: primary,
        foregroundColor: Colors.white,
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        // mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          OutlinedButton(onPressed: onNext, child: const Text("next")),
        ],
      ),
    );
  }

  void onNext() {
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => const PageOne(),
        settings: const RouteSettings(
          name: "/PageOne",
        ),
      ),
    );
  }
}
4
likes
150
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

This is a Flutter route stack information listening library. You can obtain the list of current routes, current routes, previous routes, and whether the current route is a pop-up window

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on route_stack_manager