Last active
August 11, 2020 13:38
-
-
Save shivanchalaeologic/a4ae57023337415312eebc6f79988de3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_route_obser/main.dart'; | |
class PageTwo extends StatefulWidget { | |
@override | |
_PageTwoState createState() => _PageTwoState(); | |
} | |
class _PageTwoState extends State<PageTwo> with RouteAware { | |
@override | |
void didChangeDependencies() { | |
super.didChangeDependencies(); | |
routeObserver.subscribe(this, ModalRoute.of(context)); | |
} | |
@override | |
void dispose() { | |
routeObserver.unsubscribe(this); | |
super.dispose(); | |
} | |
@override | |
void didPush() { | |
print('didPush Page2'); | |
} | |
@override | |
void didPopNext() { | |
print('didPopNext Page2'); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(), | |
body: Column( | |
children: <Widget>[ | |
Center( | |
child: Text("PAGE TWO"), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment