PersistentBottomNavBar icon indicating copy to clipboard operation
PersistentBottomNavBar copied to clipboard

How could i show a global SnakBar?

Open andrySD opened this issue 2 years ago • 1 comments

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,
    );
  }
}

andrySD avatar Dec 09 '22 12:12 andrySD

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

sed1ka avatar Mar 17 '23 03:03 sed1ka