Created
October 14, 2019 18:50
-
-
Save shihaohong/391ee612f60d1441fe34b724f7e4a148 to your computer and use it in GitHub Desktop.
to test the android 10 flutter animation
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'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
static const String _title = 'Flutter Code Sample'; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
pageTransitionsTheme: PageTransitionsTheme( | |
builders: { | |
TargetPlatform.android: ZoomPageTransitionsBuilder(), | |
}, | |
), | |
), | |
title: _title, | |
home: MyPage(), | |
); | |
} | |
} | |
class MyPage extends StatelessWidget { | |
MyPage({ | |
Key key, | |
this.pageNumber = 1, | |
}) : super(key: key); | |
final int pageNumber; | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('Another page')), | |
body: Center( | |
child: MaterialButton( | |
onPressed: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (BuildContext context) { | |
return MyPage(pageNumber: pageNumber + 1); | |
} | |
), | |
); | |
}, | |
child: Text("Push a new page"), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment