Advertisement
Guest User

Untitled

a guest
Jun 14th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.73 KB | None | 0 0
  1. class FirstPage extends StatelessWidget {  
  2.   static const String routeName = '/first-page';
  3.  
  4.   @override
  5.   Widget build(BuildContext context) { 
  6.     return Scaffold(
  7.         body: Container(
  8.             child: Center(
  9.                 child: GestureDetector(
  10.                     onTap: () => Navigator.pushNamed(context, SecondPage.routeName),
  11.                     child: Text('Go to second page!'),
  12.                 ),         
  13.             ),
  14.         ),
  15.     );
  16.   }
  17. }
  18.  
  19. class SecondPage extends StatelessWidget { 
  20.   static const String routeName = '/second-page';
  21.  
  22.   @override
  23.   Widget build(BuildContext context) { 
  24.     return Scaffold(
  25.         body: Container(
  26.             child: Center(
  27.                 child: GestureDetector(
  28.                     onTap: () => Navigator.pop(),
  29.                     child: Text('Go to first page!'),
  30.                 ),         
  31.             ),
  32.         ),
  33.     );
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement