i'm making Tiktok clone app
i'm using IndexedStack to implement this.
all good but there is one problem
I don'k know how to pause it
this is HomeScreen()
@override
void didChangeAppLifecycleState(AppLifecycleState state) async {
print('didChangeAppLifecycleState CALLED ✅');
if (state != AppLifecycleState.resumed) {
_videoListController.currentPlayer.pause();
}
}
This is navigationBar code
@override
Widget build(BuildContext context) {
_widgetOptions = <Widget>[
HomeScreen(), // Video is here ✅
SearchScreen(),
ProductScreen(),
ProfileScreen(),
];
return Scaffold(
body: IndexedStack(index: _selectedIndex, children: _widgetOptions),
bottomNavigationBar: Container(
decoration: BoxDecoration(color: Colors.white, boxShadow: [
BoxShadow(
blurRadius: 20,
color: Colors.black.withOpacity(.1),
),
]),
...
in HomeScreen() didChangeAppLifecycleState is not called when change navigation index so, player doensn't stop automatically
how can I solve this ??