Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] How can I keep the bottom navigation bar for some pages which are not directly in the index stack #651

Open
iammuho opened this issue Dec 26, 2023 · 1 comment

Comments

@iammuho
Copy link

iammuho commented Dec 26, 2023

Hey everyone,

First of all thank you a lot for this amazing package, it's so clear and work flawless. But I believe, I couldn't solve a problem.

Example I've copied: https://github.com/slovnicki/beamer/tree/master/examples/bottom_navigation_multiple_beamers

Let's assume, I've 2 pages in the bottom navigation bar and these pages lists books (imagine home page and discovery page) and when I go to book detail page from whichever I want to keep the active bottom index + bottom navigation in the book detail page.

As you can understand, books screen/location is not in the bottom bar.

If I need to make it much clear;

class AppLocationBuilder extends BeamLocation<BeamState> {
  AppLocationBuilder({RouteInformation? routeInformation})
      : super(routeInformation);
  @override
  List<String> get pathPatterns => ['/app'];

  @override
  List<BeamPage> buildPages(BuildContext context, BeamState state) {
    return [
      const BeamPage(
        key: ValueKey('app'),
        title: 'App',
        name: 'app',
        child: AppScreen(initialIndex: 0),
      ),
    ];
  }
}

and In the AppScreen;

final routerDelegates = [
    BeamerDelegate(
      initialPath: '/home',
      locationBuilder: (routeInformation, _) {
        if (routeInformation.location!.contains('topic')) {
          return TopicLocationBuilder(routeInformation: routeInformation);
        }
        return HomeLocationBuilder(routeInformation: routeInformation);
      },
    ),
    // Discover
    BeamerDelegate(
      initialPath: '/discover',
      locationBuilder: (routeInformation, _) {
        if (routeInformation.location!.contains('topic')) {
          return TopicLocationBuilder(routeInformation: routeInformation);
        }
        return DiscoverLocationBuilder(routeInformation: routeInformation);
      },
    ),

So how can I move forward with the books locations so when a user clicks books/detail/1 whichever the page, I'll keep the state and bottom bar.

best regards

@stan-at-work
Copy link
Contributor

Hey everyone,

First of all thank you a lot for this amazing package, it's so clear and work flawless. But I believe, I couldn't solve a problem.

Example I've copied: https://github.com/slovnicki/beamer/tree/master/examples/bottom_navigation_multiple_beamers

Let's assume, I've 2 pages in the bottom navigation bar and these pages lists books (imagine home page and discovery page) and when I go to book detail page from whichever I want to keep the active bottom index + bottom navigation in the book detail page.

As you can understand, books screen/location is not in the bottom bar.

If I need to make it much clear;


class AppLocationBuilder extends BeamLocation<BeamState> {

  AppLocationBuilder({RouteInformation? routeInformation})

      : super(routeInformation);

  @override

  List<String> get pathPatterns => ['/app'];



  @override

  List<BeamPage> buildPages(BuildContext context, BeamState state) {

    return [

      const BeamPage(

        key: ValueKey('app'),

        title: 'App',

        name: 'app',

        child: AppScreen(initialIndex: 0),

      ),

    ];

  }

}

and In the AppScreen;


final routerDelegates = [

    BeamerDelegate(

      initialPath: '/home',

      locationBuilder: (routeInformation, _) {

        if (routeInformation.location!.contains('topic')) {

          return TopicLocationBuilder(routeInformation: routeInformation);

        }

        return HomeLocationBuilder(routeInformation: routeInformation);

      },

    ),

    // Discover

    BeamerDelegate(

      initialPath: '/discover',

      locationBuilder: (routeInformation, _) {

        if (routeInformation.location!.contains('topic')) {

          return TopicLocationBuilder(routeInformation: routeInformation);

        }

        return DiscoverLocationBuilder(routeInformation: routeInformation);

      },

    ),

So how can I move forward with the books locations so when a user clicks books/detail/1 whichever the page, I'll keep the state and bottom bar.

best regards

Hey, 👋

Is this still an issue?

How i see it, is that you need 2 beamer instances.

And configure that they do not interfare with each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants