Skip to content

Instantly share code, notes, and snippets.

@shihaohong
Created October 14, 2019 18:50
Show Gist options
  • Save shihaohong/391ee612f60d1441fe34b724f7e4a148 to your computer and use it in GitHub Desktop.
Save shihaohong/391ee612f60d1441fe34b724f7e4a148 to your computer and use it in GitHub Desktop.
to test the android 10 flutter animation
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