flutter_dipnav 1.0.0-dev.5 copy "flutter_dipnav: ^1.0.0-dev.5" to clipboard
flutter_dipnav: ^1.0.0-dev.5 copied to clipboard

discontinued
outdated

Advanced navigation based on Navigator 2.0. Simple and reliable navigation with additional bonuses.

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

final notFoundRoute = DipNavRoute(
    path: '/404',
    page: MyHomePage(
      title: 'Error 404 - Not found page',
    ));

final initRoute = DipNavRoute(
    path: '/',
    page: MyHomePage(
      title: 'Home Page 1',
    ));

final pageRoute5 = DipNavRoute(
    path: '/page5',
    page: MyHomePage(
      title: 'Home Page 5',
    ));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DipNav.builder(
      initRoute: initRoute,
      builder: (delegate, parser, dispatcher) => MaterialApp.router(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        routerDelegate: delegate,
        routeInformationParser: parser,
        backButtonDispatcher: dispatcher,
      ),
      notFoundRoute: notFoundRoute,
      routes: [pageRoute5],
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  const MyHomePage({Key? key, required this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          if (context.dipNavData?.queries != null)
            Text('queries :${context.dipNavData?.queries}'),
          TextButton(
              onPressed: () => context.dipNav.pop(),
              child: Text('Previous page')),
          TextButton(
              onPressed: () => context.dipNav.push(
                  path: '/page3',
                  queries: {'type': 'replaced'},
                  page: MyHomePage(title: 'Home Page 3'),
                  replaceCurrent: true),
              child: Text('Replace page')),
          TextButton(
              onPressed: () => context.dipNav.push(
                  path: '/page4',
                  queries: {'type': 'cleaned_stack'},
                  page: MyHomePage(title: 'Home Page 4'),
                  removeUntil: true),
              child: Text('Remove until new page')),
          TextButton(
              onPressed: () => context.dipNav
                  .push(path: '/page2', page: MyHomePage(title: 'Home Page 2')),
              child: Text('Next page')),
        ],
      )),
    );
  }
}
5
likes
0
pub points
0%
popularity

Publisher

verified publisherdipdev.studio

Advanced navigation based on Navigator 2.0. Simple and reliable navigation with additional bonuses.

Homepage
Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, pedantic

More

Packages that depend on flutter_dipnav