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

How could i show a global SnakBar? #318

Open
AndryCU opened this issue Dec 9, 2022 · 1 comment
Open

How could i show a global SnakBar? #318

AndryCU opened this issue Dec 9, 2022 · 1 comment

Comments

@AndryCU
Copy link

AndryCU commented Dec 9, 2022

I am using persistent_bottom_nav_bar: ^5.0.2, and until now keep the botton navigation bar for all the screen, but, How can i show a global snakbar? I want to generate a snakcbar in creen A, and when i swich to creen B (using botton navigation) keep it visible. Actually when i swich the snakbar dont show in the other one

  const MainUI({super.key});

  @override
  State<MainUI> createState() => _MainUIState();
}

class _MainUIState extends State<MainUI> {
  late PersistentTabController _controller;
  final screens = [
    SalesPage(), //<- I want that when i change to this one keep wathing it
    ConfigurationPage(), //<- I had inside this screen other screen and in this one is where i show my SnakcBar
  ];

  final _navBarsItems = [
    PersistentBottomNavBarItem(
      icon: const Icon(Icons.food_bank),
      title: ("Sales"),
      activeColorPrimary: CupertinoColors.white,
      inactiveColorPrimary: CupertinoColors.systemGrey,
    ),
    PersistentBottomNavBarItem(
      icon: Icon(CupertinoIcons.settings),
      title: ("Configuration"),
      activeColorPrimary: CupertinoColors.white,
      inactiveColorPrimary: CupertinoColors.systemGrey,
    ),
  ];

  @override
  void initState() {
    super.initState();
    _controller = PersistentTabController(initialIndex: 0);
  }

  @override
  Widget build(BuildContext context) {
    return PersistentTabView(
      key: scaffoldKey,
      backgroundColor: Colors.blue.shade400,
      context,
      screens: screens,
      items: _navBarsItems,
    );
  }
}
@sed1ka
Copy link

sed1ka commented Mar 17, 2023

The behaviour also occurs on me when using another bottomNavigationBar
Maybe the problem is not from this plugins

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