forked from md-siam/widget_of_the_day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpageroute_builder.dart
52 lines (48 loc) · 1.29 KB
/
pageroute_builder.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import 'package:flutter/material.dart';
import 'package:widget_of_the_day/80_pageroute_builder/BouncyPageRoute.dart';
class MyPageRouteBuilder extends StatelessWidget {
const MyPageRouteBuilder({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple[100],
appBar: AppBar(title: const Text('PageRouteBuilder')),
body: Center(
child: MaterialButton(
color: Colors.deepOrange,
child: const Text(
'Second',
style: TextStyle(color: Colors.white),
),
onPressed: () {
Navigator.push(
context,
BouncyPageRoute(
widget: const SecondPage(),
),
);
},
),
),
);
}
}
class SecondPage extends StatelessWidget {
const SecondPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(title: const Text('Second Page')),
body: const Center(
child: Text(
'Second Page',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
),
);
}
}