A Flutter package that makes navigation and routing easy.

Related tags

Analytics vrouter
Overview

VRouter logo

VRouter website Join our discord Github repo pub package


A Flutter package that makes navigation and routing easy.

Learn more at vrouter.dev

Here are a few things that this package will make easy:

  • Automated web url handling
  • Nesting routes
  • Transition
  • Advanced url naming
  • Reacting to route changing
  • Customizable pop events
  • And much more...

Index

Getting started

VRouter

VRouter is a widget which handles the navigation, it acts as a MaterialApp but also takes a routes arguments.

VRouter(
 debugShowCheckedModeBanner: false, // VRouter acts as a MaterialApp
 routes: [...], // Put your VRouteElements here
)

VRouteElements

VRouteElements are the building blocs of your routes.

Note that they are not widgets but the way you use them is very similar to widgets.

VWidget

VWidget maps a path to a widget:

VWidget(path: '/login', widget: LoginScreen())

VGuard

VGuard allows you to take actions when the route is accessed/leaved:

VGuard(
 beforeEnter: (vRedirector) async => , // Triggered when a route in stackedRoutes is first displayed
 beforeUpdate: (vRedirector) async => , // Triggered when a route in stackedRoutes is displayed but changes
 beforeLeave: (vRedirector, _) async => , // Triggered when VGuard is not part of a new route
 stackedRoutes: [...],
);

VRouteRedirector

VRouteRedirector redirects from a route to another:

VRouteRedirector(path: '/old/home', redirectTo: '/home')

VNester

VNester are used when you need to nested widgets instead of stacking them:

VNester(
 path: '/home',
 widgetBuilder: (child) => MyScaffold(body: child), // child will take the value of the widget in nestedRoutes
 nestedRoutes: [
   VWidget(path: 'profile', widget: ProfileScreen()), // path '/home/profile'
   VWidget(path: 'settings', widget: SettingsScreen()), // path '/home/settings'
 ],
)

VPopHandler

VPopHandler helps you control pop events:

VPopHandler(
 onPop: (vRedirector) async =>, // Called when this VRouteElement is popped
 onSystemPop: (vRedirector) async =>, // Called when this VRouteElement is popped by android back button
 stackedRoutes: [...],
)

Navigation

Navigating is easy, just access VRouter with context.vRouter and navigate:

context.vRouter.to('/home'); // Push the url '/home'

context.vRouter.toSegments(['home', 'settings']); // Push the url '/home/settings'

Useful notions

Composition

VRouteElements are designed like widgets: compose them to create the route you need.

Compose VRouteElements

To compose VRouteElements, use the stackedRoutes attribute (or the nestedRoutes attribute for VNester):

// Composing a VGuard and a VWidget
VGuard(
 beforeEnter: (vRedirector) async => !isLoggedIn ? vRedirector.to('/login') : null,
 stackedRoutes: [
   VWidget(path: '/home', widget: HomeScreen()),
 ],
)

Create custom VRouteElements

You can even create your own VRouteElement, as you extend VWidget. You just need to extends VRouteElementBuilder:

class HomeRoute extends VRouteElementBuilder {
 static String home = '/home';

 @override
 List<VRouteElement> buildRoutes() {
   return [
     VGuard(
       // LoginRoute.login = '/login' for example
       beforeEnter: (vRedirector) async => !isLoggedIn ? vRedirector.to(LoginRoute.login) : null,
       stackedRoutes: [
         VWidget(path: home, widget: HomeScreen()),
       ],
     ),
   ];
 }
}

and then use this VRouteElement as any other:

VRouter(
 routes: [
   HomeRoute(),
   ...
 ],
)

This can be used to:

  • Separate you different routes in different VRouteElement
  • Create reusable VRouteElement
  • Use static String to organise your paths

Note: you often want to use a shared VNester in different VRouteElementBuilders, for this specific use case, see vrouter.dev/Custom VRouteElement And Scaling

Path

Relative path

Paths can be relative: if you don’t start your path with /. If you use null, the path will be the one of the parent:

VNester(
 path: '/home',
 widgetBuilder: (child) => MyScaffold(body: child),
 nestedRoutes: [
   VWidget(path: null, widget: HomeScreen()), // Matches '/home'
   VWidget(path: 'settings', widget: SettingsScreen()), // Matches '/home/settings'
 ]
)

Path parameters

Paths can have path parameters, just use “:” in front of the path parameter’s name:

VWidget(path: '/user/:id', widget: UserScreen())

And access it in your widgets using:

context.vRouter.pathParameters['id'];

Wildcards

Wildcards are noted * and there are of one of two types:

  • Trailing wildcards (a path ending with *) will match everything
  • an in-path wildcard (a wildcard between slashes) will match one word
// Redirects any path to '/unknown'
VRouteRedirector(path: '*', redirectTo: '/unknown')

Path parameters regexp

Path parameters can use regex, just put the regex in parentheses. This is often used in VRedirector to redirect any unknown route:

// The path parameter name is “bookId” and it uses the regex “\d+” to match only digits
VWidget(path: r':bookId(\d+)', widget: BookScreen())

Note that such a VRedirector should be used as your last route otherwise it will always be matched.

Aliases

Use aliases for multiple paths:

// Matches '/settings' and '/other'
VWidget(path: '/settings', aliases: ['/other'], widget: SettingsScreen())

VRedirector

You often want to redirect or stop the current redirection in VGuard and VPopHandler. For that purpose, you get a VRedirector:

VGuard(
 beforeEnter: (vRedirector) async => !isLoggedIn ? vRedirector.to('/login') : null,
 stackedRoutes: [...],
)

VRouterData

VRouter contains data (such as the path or path parameters) that you might want to access in your widget tree. There are 2 ways of doing do:

// Use the context
context.vRouter

// Use the builder constructor of some VWidget or VNester
VWidget.builder(
  path: '/:id', 
  builder: (context, state) => Book(id: state.pathParameters['id'] as int),
)

Go Beyond

We have just scratched the surface of what VRouter can do. Here are a few other things which you might like.

Initial url

Maybe you want to redirect people to a certain part of your app when they first launch it, then use initialUrl:

VRouter(
 initialUrl: '/home',
 routes: [...],
)

Logs

By default, VRouter shows logs of every navigation events.

You can remove these logs using VLogs.none:

VRouter(
  logs: VLogs.none,
  routes: [...],
);

Named route

You might have to access a deeply nested VRouteElement and don’t want to have to write the full url. Just give a name to this VRouteElement:

VWidget(path: 'something', widget: SomeWidget(), name: 'deep')

And navigate using toNamed:

context.vRouter.toNamed('deep');

Transitions

You can either specify a default transition in VRouter, or a custom one in VWidget or VNester

VRouter(
 // Default transition
 buildTransition: (animation1, _, child) => FadeTransition(opacity: animation1, child: child),
 routes: [
   // The custom ScaleTransition will play for '/user'
   VWidget(
     path: '/user',
     widget: UsersScreen(),
     buildTransition: (animation1, _, child) => ScaleTransition(scale: animation1, child: child),
   )
   // The default FadeTransition will play for '/settings'
   VWidget(path: '/settings', widget: SettingsScreen()),
 ],
)

Much more

There is so much more that this package can do, check out the example or have a look at the vrouter.dev website for more documentation and more examples.

Also don’t hesitate to join us on discord !

Comments
  • Preserve stack when switching between nested routes

    Preserve stack when switching between nested routes

    My app uses tabbed navigation, in which each tab maintains its own independent stack. When switching between tabs, the route stack should be preserved for the given tab.

    Here is what I have so far. However, I can't figure out how to get each tab to maintain its route stack when switching back.

    Any guidance would be much appreciated.

      final _tabRoutes = [
        VWidget(path: '/kriyas', widget: AllKriyasScreen()),
        VWidget(path: '/kriyas/:kriyaId', widget: KriyaDetailsScreen('')),
      ];
    
    return VRouter(
          theme: theme,
          title: 'Kundalini',
          initialUrl: '/practice',
          routes: [
            VNester(
              path: null,
              widgetBuilder: (child) => AppTabsScaffold(child: child),
              nestedRoutes: [
                VWidget(
                  widget: PracticeScreen(),
                  path: '/practice',
                  stackedRoutes: _tabRoutes,
                ),
                VWidget(
                  widget: ListenScreen(),
                  path: '/listen',
                  stackedRoutes: _tabRoutes,
                ),
                VWidget(
                  widget: LearnScreen(),
                  path: '/learn',
                  stackedRoutes: _tabRoutes,
                ),
              ],
            )
          ],
        )
    

    Where AppTabScaffold is

    class AppTabsScaffold extends StatelessWidget {
      final Widget child;
    
      AppTabsScaffold({required this.child});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: SafeArea(
            top: false,
            child: child,
          ),
          bottomNavigationBar: Material(
            elevation: 8.0,
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                MiniPlayer(),
                BottomNavigationBar(
                    type: BottomNavigationBarType.fixed,
                    currentIndex: 0,
                    onTap: (index) {
                      switch (index) {
                        case 0:
                          return context.vRouter.push('/practice');
                        case 1:
                          return context.vRouter.push('/listen');
                        case 2:
                          return context.vRouter.push('/learn');
                      }
                    },
                    items: [
                      BottomNavigationBarItem(
                        icon: Icon(MdiIcons.yoga),
                        backgroundColor: Theme.of(context).primaryColor,
                        label: 'Practice',
                      ),
                      BottomNavigationBarItem(
                        icon: Icon(Icons.music_note_rounded),
                        backgroundColor: Theme.of(context).primaryColor,
                        label: 'Listen',
                      ),
                      BottomNavigationBarItem(
                        icon: Icon(Icons.menu_book_rounded),
                        backgroundColor: Theme.of(context).primaryColor,
                        label: 'Learn',
                      ),
                    ]),
              ],
            ),
          ),
        );
      }
    }
    
    opened by smkhalsa 32
  • Info logging break flutter hot reload

    Info logging break flutter hot reload

    Hello I really like your package and starting to use in my project after more than one hour trying to fix why hot reload not working in the IDE. and tried everything to fix but nothing changed until I change logging of VRouter to VLogs.warning and everything work perfectly.

    I don't know why this happened only in the IDE but it work in terminal

    opened by rebaz94 26
  • How To Using Pop() In Vrouter?

    How To Using Pop() In Vrouter?

    I have a page /abc and I push('/def') How can I pop() to go back to the /abc trang page I don't want to use push('/abc') because it will create the effect of opening a new page instead of going back to the previous page.

    enhancement 
    opened by leanhro2812 26
  • Express your opinion: shift in the package mindset

    Express your opinion: shift in the package mindset

    Hi,

    I am considering changing this package quite a bit. I know that people are already using it and rely on it but it has always been obvious that this was not the final version.

    Over all, the change would means:

    • More flexible routing
    • Flutter-like structure, with smaller component each having a specific role
    • The possibility to expand the functionality of this package easily
    • Stronger auto-complete

    According to mean, this would fix the biggest issue there is: VStack and VChild now contain 17 attributes, the combination are not always possible. And this is before adding declarative routing to this package. My idea would be to break down VStack and VChild into several smaller components.

    Here is a small example illustrating the idea:

    OLD METHOD

      VRouter(
        routes: [
          VStacked(
            path: '/login',
            widget: LoginWidget(),
          ),
          VStacked(
            widgetBuilder: (vChild) => MyScaffold(vChild),
            subroutes: [
              VChild(
                path: '/home',
                widget: HomePage(),
              ),
              VChild(
                path: '/settings',
                widget: SettingsPage(),
              ),
            ]
          ),
        ],
      );
    

    NEW METHOD

    VRouter(
      route: VSwitcher(
        subroutes: [
          VPath(
            path: '/login',
            subroute: VWidget(
              widget: LoginPage(),
            ),
          ),
          VChildGetter(
            widgetBuilder: (vChild) => MyScaffold(vChild)
            subroute: VSwitcher(
              subroutes: [
                VPath(
                  path: '/home',
                  subroute: VWidget(
                    widget: HomePage(),
                  ),
                ),
                VPath(
                  path: '/settings',
                  subroute: VWidget(
                    widget: SettingsPage(),
                  ),
                ),
              ]
            ),
          ),
        ],
      ),
    );
    

    If you count, there is 2 more classes in the new version but each class is very specialized. This means that you get easier auto completion, and we could easily add new classes to extend the functionalities.

    Something interesting is for example to change the path matching algorithm to be more like the react router one, allowing more freedom in the stacking (currently you can't get this kind of app for example)

    Tell me what you think ! Maybe I am completely wrong but I feel like this would be a huge plus for VRouter.

    opened by lulupointu 23
  • Not an issue, just a question [Behavior web vs. mobile]

    Not an issue, just a question [Behavior web vs. mobile]

    Edit: Achieved everything from my "list" in this post. Solutions are below... Thanks a ton @lulupointu!

    Hello,

    first I'm sorry I'm raising an issue but I'ld like to ask some question about VRouter, because this looks very handy for my needs.

    On my research for a new navigation system for our productive application I've stumbled over VRouter.

    Tried around for quiet a few hours now and still asking me:

    • same navigation concept for mobile / desktop / web ✅

    • for web having URL's to browse to the page with an link ✅

    • different route behavior mobile vs. desktop / web ✅

      • on web / desktop there is enough space for drawer, a list, detail selected from list
      • on tablet there is enough space for a list and the detail selected, drawer is reachable with the appbar
      • on mobile there is space for the list and by tapping an item it should push to the detail view
      • so the behaviour on selecting an item on mobile is different to the other systems
    • nested navigation - i don't want to rebuild the drawer each time I click on the lists view the details of this item ✅

      • nesting works great for my need but everything around is rebuilding everytime
    • transitions should be deactivateable (most approaches I've gone through are possible to do this) ✅

    • route guards to check if the user is able to load this page ✅

    Could you maybe help me achieve this goals? Thanks a ton!

    opened by Aerofluxx 22
  • Unable to pass params directly to view

    Unable to pass params directly to view

    One use case I would really like to do with a library like this, is to parse params directly in the routing table, kind of like we used to do with onGenerateRoute. This way the view doesn't have to parse, it is just cleanly passed it's dependencies.

    VWidget(
      path: "/product/:id",
      widget: ProductPage(
        pageId: getRouter()?.pathParameters["id"],
      ),
    )
    

    I can't seem to find a nice way to do this currently? Even if I inject it into a shared model, there are still some issues:

    • onBeforeUpdate - Seems to be no access to the new path params here, so no way to parse the id.
    • onAfterUpdate - View has already built by now (initState has fired)
    • inline (as above) - Params are always old

    A couple of things that could help is:

    • VWidgetBuilder(builder: (params){ }) - We can parse things here, and inject straight into the views
    • onBeforeUpdate(_, newParams) - Pass the new params into the update, so we can inject them into a model if we need before the view has rendered.

    The main reason for this is separation of concerns. If Pages can depend on constructor injection they are easier to test and simpler to understand. I also appreciate how it keeps the parsing close to the declaration ("id" is 2 lines away from ":id").

    I think the builder in particular is quite nice. It removes the boilerplate around assigning a key in order to access the params from the routing tree, and just passes the new params directly.

    VWidget(
      path: "/product/:id",
      widgetBuilder: (params) => ProductPage(pageId: params["id"]),
    )
    
    opened by esDotDev 22
  • Error on Deeplink on iOS

    Error on Deeplink on iOS

    Hi, First of all thanks for your package, it makes using Navigator 2.0 so easy :D I've been trying to achieve deeplinking with it on iOS without success.

    I have a route with the following path : /event/:id AfterI have used this documentation to add deeplinking on my iOS app : https://flutter.dev/docs/development/ui/navigation/deep-linking.

    When i run xcrun simctl openurl booted customscheme://flutterbooksample.com/event/EGm8O6y70nfbR8xoP5YP in my terminal, I have the following log:

    [VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: Exception: replaceHistoryState should only be used on the web
    #0      BrowserHelpers.replaceHistoryState
    package:vrouter/…/browser_helpers/browser_helpers_none.dart:15
    #1      VRouterDelegate._updateUrl
    package:vrouter/…/core/vrouter_delegate.dart:677
    <asynchronous suspension>
    #2      VRouterDelegate.setNewRoutePath
    package:vrouter/…/core/vrouter_delegate.dart:1408
    <asynchronous suspension>
    

    How could I fix this ?

    Thanks a lot

    opened by Lyokone 18
  • After pop VWidgetGuard still in the _vWidgetGuardMessagesRoot

    After pop VWidgetGuard still in the _vWidgetGuardMessagesRoot

    I have quite a simple login on the stacked page, do not pop (system pop) until some requirements are met. And it works. Unfortunately, even after popping the page, the same login is called even on the parent pages. Of course, it ends with the exception:

    Looking up a deactivated widget's ancestor is unsafe. At this point the state of the widget's element tree is no longer stable

    System pop is not longer working ;)

    has reproducible steps 
    opened by sirjasiu 17
  • Support for flows

    Support for flows

    Thanks for the package, looks great and very comprehensive!

    I was wondering if there are plans for supporting flows with declarative routing.

    This would be similar to felangel's flow_builder package and milad's auto_route package (AutoRoutet.declarative)

    Thanks

    opened by theweiweiway 16
  • Delay when building with VRouter

    Delay when building with VRouter

    I'm seeing nearly a 300ms delay before the builder() is called in VRouter. Any ideas?

    Here I trace out 3 times,

    • initState
    • initState + scheduleMicrotack (frame 2)
    • VRouter.builder

    flutter: InitState @ 0 flutter: Frame2 @ 197ms flutter: VRouter Build @ 284ms

    opened by esDotDev 15
  • VRouter Crashing when reloading web page

    VRouter Crashing when reloading web page

    Problem

    My Web App crashes when I reload the Web page in the browser. I get this error:

    For a more detailed help message, press "h". To quit, press "q".
    Error: Expected a value of type 'String?', but got one of type 'LinkedMap<dynamic,
    dynamic>'
        at Object.throw_ [as throw] (http://localhost:5000/dart_sdk.js:5334:11)
        at Object.castError (http://localhost:5000/dart_sdk.js:5305:15)
        at Object.cast [as as] (http://localhost:5000/dart_sdk.js:5621:17)
        at dart.NullableType.new.as (http://localhost:5000/dart_sdk.js:7182:60)
        at Function.getHistoryState
        (http://localhost:5000/packages/vrouter/src/web_helpers.dart.lib.js:1911:27)
        at main.VRouterState.new.<anonymous>
        (http://localhost:5000/packages/vrouter/src/web_helpers.dart.lib.js:4744:201)
        at Generator.next (<anonymous>)
        at runBody (http://localhost:5000/dart_sdk.js:39052:34)
        at Object._async [as async] (http://localhost:5000/dart_sdk.js:39083:7)
        at simple_url_handler.SimpleRouterDelegate.new.<anonymous>
        (http://localhost:5000/packages/vrouter/src/web_helpers.dart.lib.js:4741:24)
        at simple_url_handler.SimpleRouterDelegate.new.setNewRoutePath
        (http://localhost:5000/packages/simple_url_handler/simple_url_handler.dart.lib.js:81
        7:19)
        at simple_url_handler.SimpleRouterDelegate.new.setInitialRoutePath
        (http://localhost:5000/packages/flutter/src/widgets/widget_span.dart.lib.js:19193:21
        )
        at _RootZone.runUnary (http://localhost:5000/dart_sdk.js:38889:58)
        at _FutureListener.then.handleValue (http://localhost:5000/dart_sdk.js:33875:29)
        at handleValueCallback (http://localhost:5000/dart_sdk.js:34435:49)
        at Function._propagateToListeners (http://localhost:5000/dart_sdk.js:34473:17)
        at _Future.new.[_completeWithValue] (http://localhost:5000/dart_sdk.js:34315:23)
        at http://localhost:5000/dart_sdk.js:34252:39
        at SynchronousFuture.new.then
        (http://localhost:5000/packages/flutter/src/foundation/synchronous_future.dart.lib.j
        s:54:22)
        at _Future.new.[_chainForeignFuture] (http://localhost:5000/dart_sdk.js:34248:18)
        at Function._propagateToListeners (http://localhost:5000/dart_sdk.js:34494:44)
        at _Future.new.[_completeWithValue] (http://localhost:5000/dart_sdk.js:34315:23)
        at async._AsyncCallbackEntry.new.callback
        (http://localhost:5000/dart_sdk.js:34338:35)
        at Object._microtaskLoop (http://localhost:5000/dart_sdk.js:39176:13)
        at _startMicrotaskLoop (http://localhost:5000/dart_sdk.js:39182:13)
        at http://localhost:5000/dart_sdk.js:34689:9
    

    It works before reloading the web page and on mobile platforms. Am I doing something wrong or is it a problem with the library?

    This is my Code:

    VRouter(
            debugShowCheckedModeBanner: false,
            localizationsDelegates: LOCALIZATION_DELEGATES,
            supportedLocales: SUPPORTED_LOCALES,
            routes: [
              VStacked(
                path: "/",
                name: "/",
                widget: MaterialAppFrame(child),
              ),
              VStacked(
                path: "/invite",
                widget: InvitePage(),
              ),
            ],
            darkTheme: ThemeService.darkTheme,
            theme: ThemeService.lightTheme,
            themeMode: ThemeService().getThemeMode(data()),
          );
    

    Versions

    • flutter: 2.0.2 Stable
    • vrouter: ^1.0.0-nullsafety.11 (also tried with 0.0.15, same thing happens)
    opened by felixwortmann 15
  • Change URL without refreshing the page

    Change URL without refreshing the page

    Hi @lulupointu First of all, thanks for this strong package, I can't even compare it with go_router... It's a pity that the go_router went more popular than this package, so thanks for your efforts.

    I have a question, I want to change the url without refreshing the page. How can I achieve that?

    For example I have this in my url: post/1536 Then I want to change it to post/someID when user start scrolling the posts. If I use context.vRouter.to or toNamed with new path params, potentially it'll be start refreshing and I want to avoid this.

    opened by iliyami 2
  • Access the current active VRouteElement

    Access the current active VRouteElement

    Hi,

    Thank you for this lovely package, I am straggling trying to find a way to access the current VRouteElement (VWidget), my main goal is be able to access the widget in VWidget programmatically, Is there a way I could do it? maybe thought of scope for example!

    VWidget(
        path: '/profile',
        name: 'profile',
        widget: const ProfilePage(),
    ),
    

    Thank you in advance 🙂

    opened by mohkoma 0
  • Push hash to history

    Push hash to history

    I'd like to be able to append a hash parameter to a url on user action without causing a page reload. Widget rebuild is fine, but nothing that destructs the current widget tree. Ideally functionality identical to Javascript History.pushState(). Currently the only option that I can find is to use to(), and with or without isReplacement it seems to force a full page navigation w/ widget destruction.

    opened by CosmicPangolin 0
  • `Multiple widgets used the same GlobalKey` when nesting `VNester`s

    `Multiple widgets used the same GlobalKey` when nesting `VNester`s

    Issue type: Question Platform: Web

    I have an app which produces this when trying to add a nested nesters. I assume this might be related to this https://github.com/lulupointu/vrouter/issues/77#issuecomment-851869374 ? I have also seen other issues here mentioning roughly the same, but I still don't really understand why this happens.

    Do you have a general explanation for these kind of issues? I am trying to wrap my head around navigation in Flutter, so might be that I have completely misunderstood my issue as well :) hehe

    [VRouter: INFO] Successfully navigated to "/family/fid1234/person/pers123/prop/prop123/prop2/prop1234" using VRouter.to 
    nesten builder 1
    nested builder 2
    nesten builder 1
    nested builder 2
    nested builder 2
    nested builder 2
    ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    The following assertion was thrown while finalizing the widget tree:
    Multiple widgets used the same GlobalKey.
    The key [LabeledGlobalKey<NavigatorState>#96b66 VNesterPageBase of name null and key null
    navigatorKey] was used by multiple widgets. The parents of those widgets were different widgets that
    both had the following description:
      Builder
    A GlobalKey can only be specified on one widget at a time in the widget tree.
    

    The first time I go to the path this works, but when navigating to new path where only some of the pathparams from the first path has been updated I get what you see here. Even though there is only one Successfully navigated to... entry it enters the builder two times.

    opened by momrak 1
  • vRouter is not detecting back button press.

    vRouter is not detecting back button press.

    Hello, I'm new at vrouter currently. But I've tried to do as exactly as you have mentioned in the doc. LINK But In my code format It's not working with VPopHandler and VWidgetGuard , I just to handle the backpress in every Widget on my own.

    My code structure of main route :

    Future _onSystemPop(VRedirector vRedirector) async {
        logger.i("this is called");
      }
    
    VRouter(
          scrollBehavior: MyCustomScrollBehavior(),
          debugShowCheckedModeBanner: false,
          mode: VRouterMode.history,
          logs: VLogs.info,
          routes:  [
            VWidget(path: '', widget: const SplashScreen()),
            VPopHandler(onSystemPop: _onSystemPop, stackedRoutes: [
              VNester.builder(
            key: const ValueKey('routes/homework'),
            navigatorKey: _navigationKey,
            path: basePath,
            widgetBuilder: (_context, state, child) => HomeworkScaffold(child),
            nestedRoutes: [
              VWidget(path: ':studentHomeworkId', name: 'home', widget: const HomeScreen()),
            ],
          )
            ]),
            VWidget(path: '*', widget: build404Screen()),
          ],
        )
    

    HomeScreen() :

    class HomeworkScreen extends StatefulWidget {
      const HomeworkScreen({Key? key}) : super(key: key);
    
      @override
      _HomeworkScreenState createState() => _HomeworkScreenState();
    }
    
    class _HomeworkScreenState extends State<HomeworkScreen> {
      @override
      void initState() {
        super.initState();
        
      }
      @override
      Widget build(BuildContext context) {
    
        Future _onSystemPop(VRedirector vRedirector) async {
          logger.i("this is called_onSystemPop");
        }
        Future _onPop(VRedirector vRedirector) async {
          logger.i("this is called_on_onPop");
        }
        return VWidgetGuard(
            afterEnter: (_context, _from, _to) async {
              await initWidget();
              initTimer();
            },
            onSystemPop: _onSystemPop,
            onPop:_onPop,
            child: 
            );
      }
    }
    

    I've logged 3 functions here, and on backpress I've getting none of it. Can you please help me out!! thanks

    opened by ishanajmeri 0
Owner
null
Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

biyidev 897 Jan 9, 2023
A sound meter app. Made with Flutter.

A sound meter app. Made with Flutter.

Fareez Iqmal 7 Dec 21, 2022
Flutter starter project - a template with best practices for starting a new app or becoming familiar with the architecture of our projects

Flutter starter project - a template with best practices for starting a new app or becoming familiar with the architecture of our projects

PatchAI 72 Nov 24, 2022
This plugin allows Flutter desktop apps to defines system tray.

tray_manager This plugin allows Flutter desktop apps to defines system tray. tray_manager Platform Support Quick Start Installation ⚠️ Linux requireme

LeanFlutter 122 Dec 22, 2022
Instagram Clone made with Flutter

Instagram Clone made with Flutter

Hmida 22 Oct 14, 2022
A fitness app fetching data from Json built on flutter.

A fitness app fetching data from Json built on flutter.

null 0 Oct 5, 2021
Flutter file based routing - File based routing and nested layouts for Flutter

Flutter File Based Routing I was inspired by the routing in remix.run with neste

Rody Davis 10 Sep 29, 2022
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

English | Português The brightest, hippest, coolest router for Flutter. Features Simple route navigation Function handlers (map to a function instead

Luke Pighetti 3.5k Jan 4, 2023
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Luke Pighetti 3.5k Jan 4, 2023
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

English | Português The brightest, hippest, coolest router for Flutter. Features Simple route navigation Function handlers (map to a function instead

Luke Pighetti 3.5k Jan 4, 2023
Easy-to-use Navigator 2.0 router for web, mobile and desktop. URL-based routing, simple navigation of tabs and nested routes.

Routemaster Hello! Routemaster is an easy-to-use router for Flutter, which wraps over Navigator 2.0... and has a silly name. Features Simple declarati

Tom Gilder 291 Jan 3, 2023
Flutter Navigation Best Practices including adapting navigation to platform and branding techniques for navigation surfaces.

Flutter Navigation Best Practices including adapting navigation to platform and branding techniques for navigation surfaces.

Fred Grott 5 Aug 22, 2022
Tour guide App UI in Flutter Consist of Three Pages. First Screen is Splash Screen , Second is welcome screen routing to third Screen and Third screen consist of details , navigation, places, and responsive UI.

Tour Guide // Tourism App Ui in Flutter. Tour Guid App Ui in Flutter. Visit Website Features State Management Navigation Bar Responsive Design Hybrid

Habib ullah 2 Nov 14, 2022
Circular Bottom Navigation Iman KhoshabiCircular Bottom Navigation [368⭐] - Beautiful animated bottom navigation bar by Iman Khoshabi.

Circular Bottom Navigation (or maybe a tab bar). This is implementation of an artwork in Uplabs Donate Support us by becoming a patron on Patreon Let'

Iman khoshabi 523 Dec 30, 2022
Okan YILDIRIM 37 Jul 10, 2022
Doctor Consultation App in Flutter containing splash screen on boarding screen Routing state management Dash board Bottom navigation Decorated Drawer and Doctors Screen in the last.

Online doctor Consultation App UI in Flutter Doctor Consultation App UI in Flutter Visit Website Features State Management Navigation Bar Responsive D

Habib ullah 14 Jan 1, 2023
A flutter application for Navigation and routing issues

A flutter application for Navigation and routing issues.. The Application is about the meals, in which description of the meals is provided and the proper management of routes and navigation has been implemented.

Mohammad Abdur Rehman Cheema 2 May 22, 2022
Let's create a selectable Flutter Navigation Drawer with routing that highlights the current item within the Flutter Sidebar Menu.

Flutter Tutorial - Sidebar Menu & Selectable Navigation Drawer Let's create a selectable Flutter Navigation Drawer with routing that highlights the cu

Johannes Milke 12 Dec 26, 2022
A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka "Navigator 2.0".

A Flutter package to help you handle your application routing and synchronize it with browser URL. Beamer uses the power of Router and implements all

Sandro Lovnički 485 Jan 7, 2023
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 140 Dec 30, 2022