flutter_cupertino_will_pop_scope icon indicating copy to clipboard operation
flutter_cupertino_will_pop_scope copied to clipboard

Back swipe gesture not work when use CupertinoTabView

Open Kadmiv opened this issue 2 years ago • 0 comments

Swipe gesture does not work when using nesting and navigation inside CupertinoTabView

For example :

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CupertinoTabScaffold(
        tabBar: CupertinoTabBar(
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              activeIcon: Icon(Icons.home),
            ), BottomNavigationBarItem(
              icon: Icon(Icons.home),
              activeIcon: Icon(Icons.home),
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              activeIcon: Icon(Icons.home),
            ),
          ],
        ),
        tabBuilder: (_, int index) {
          return CupertinoTabView(
            builder: (context) => Center(
              child: ElevatedButton(
                child: Padding(
                  padding:
                      EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
                  child: Text('Go to second screen'),
                ),
                onPressed: () => _goToSecondScreen(context),
              ),
            ),
            routes: <String, WidgetBuilder>{
              "SecondScreen": (_) => SecondScreen(),
            },
          );
        },
      ),
    );
  }

  void _goToSecondScreen(BuildContext context) =>
      Navigator.of(context).pushNamed('SecondScreen');
}

Kadmiv avatar Jan 23 '23 13:01 Kadmiv