I have home page and bottomNavigationBar with 3 to 5 Page view as shown below. Each page view opens new page (new ASummary(index: this._page),) such as;
- a_summary.dart,
- b_summary.dart etc.
Each child page (ex: a_summary.dart) opens a different pages with user interaction using;
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new Account()));
Each Summary pages also opens a different pages with user interaction using Navigator.push. The navigation tree/page (a_summary.dart) is very deep, such as a_summary page as deep as 10 page.
- a_summary stateful
- aa.page
- aaa.page
- aaaa.page
- aaaaa.page etc.
In home page I have a timer set to 5 min. If no user interaction in 5 min the timer jumps to login page. my home page the GestureDetector and timer works if the user has interaction with bottomNavigationBar pages. I use GestureDetector to all my pages. my timer function in home.dart. But when I enter rooted pages like aaaaa.page or any other similar pages my home GestureDetector and timer is not working.
home.dart page code:
class _MyUserHomePageState extends State<MyUserHomePage> {
Timer _timer;
PageController _pageController;
int _page;
// TODO: MAIN BUILD WIDGET
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: _handleUserInteraction,
child: new Scaffold(
body: new PageView(
children: [
new ASummary(index: this._page),
new BSummary(index: this._page),
new CSummary(index: this._page),
new DSummary(index: this._page),
new ESummary(index: this._page),
],
onPageChanged: onPageChanged,
controller: _pageController,
),
bottomNavigationBar: new Theme(
data: Theme.of(context).copyWith(
canvasColor: capitalDarkGreen,
primaryColor: capitalLightGreen,
child: new BottomNavigationBar(
items: [
new BottomNavigationBarItem(title: new Text( “A”,)),
new BottomNavigationBarItem(title: new Text( “B”,)),
new BottomNavigationBarItem(title: new Text( “C”,)),
new BottomNavigationBarItem(title: new Text( “D”,)),
new BottomNavigationBarItem(title: new Text( “E”,)),
],
onTap: navigationTapped,
currentIndex: this._page,
),
),
),
));
}
}
Each rooted page is under different folder. My question is how to add Top Level GestureDetector to my Flutter app so I can activate/deactivate my home.dart timer using GestureDetector even my app deeply rooted? Or is there better option for this idea?
The idea is after user login, if no user interaction 5 min, app automatically jumps to login page.