flutter_cupertino_will_pop_scope
flutter_cupertino_will_pop_scope copied to clipboard
Back swipe gesture not work when use CupertinoTabView
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');
}