jb3rndt / PersistentBottomNavBarV2

A highly customizable persistent bottom navigation bar for Flutter
https://pub.dev/packages/persistent_bottom_nav_bar_v2
BSD 3-Clause "New" or "Revised" License
47 stars 48 forks source link

Arguments can be set in RouteAndNavigatorSettings #134

Closed Miya49-p0 closed 3 months ago

Miya49-p0 commented 3 months ago

Is your feature request related to a problem? Please describe. I want to be able to set arguments on the root screen

Describe the solution you'd like

  Route<dynamic>? _onGenerateRoute(RouteSettings settings) {
    final String? name = settings.name;
    WidgetBuilder? routeBuilder;
    //String title;
    if (name == Navigator.defaultRouteName && widget.builder != null) {
      routeBuilder = widget.builder;
      //title = widget.defaultTitle;
    } else if (widget.routeAndNavigatorSettings!.routes != null) {
      routeBuilder = widget.routeAndNavigatorSettings!.routes![name!];
    }
    if (routeBuilder != null) {
      return PageRouteBuilder(
        pageBuilder: (context, animation, secondaryAnimation) =>
            routeBuilder!(context),
        transitionsBuilder: (context, animation, secondaryAnimation, child) {
          return child;
        },
        settings: RouteSettings(
            name: widget.routeAndNavigatorSettings!.initialRoute ??
                '/9f580fc5-c252-45d0-af25-9429992db112'),
                arguments: widget.routeAndNavigatorSettings!.arguments //ADD
      );
    }
    if (widget.routeAndNavigatorSettings!.onGenerateRoute != null)
      return widget.routeAndNavigatorSettings!.onGenerateRoute!(settings);
    return null;
  }

It would be very helpful if you could let me know if there is a way to pass arguments to each root view of tab even if this function is not available.

jb3rndt commented 3 months ago

Hi, in the PersistentTabConfig you have a navigatorConfig option. You can pass in a NavigatorConfig object for each individual tab. There, you can specify everything as in RouteAndNavigatorSettings. Does solve your issue?

Miya49-p0 commented 3 months ago

@jb3rndt Hi! I didn't know about the recent updates. I checked the following link and understood what you were saying. https://github.com/jb3rndt/PersistentBottomNavBarV2/blob/master/MigrationGuide.md

This is probably the best answer for me. Thank you very much