Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(Main());
  4.  
  5. class Main extends StatefulWidget {
  6. @override
  7. _MainState createState() => _MainState();
  8. }
  9.  
  10. class _MainState extends State<Main> {
  11. @override
  12. Widget build(BuildContext context) {
  13. return MaterialApp(
  14. home: MyHero()
  15. );
  16. }
  17. }
  18.  
  19. class MyHero extends StatefulWidget {
  20. @override
  21. _MyHeroState createState() => _MyHeroState();
  22. }
  23.  
  24. class _MyHeroState extends State<MyHero> {
  25. @override
  26. Widget build(BuildContext context) {
  27. return Scaffold(
  28. body: Center(
  29. child: Column(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
  30. Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
  31. OutlineButton( child: Text("Page 1"), onPressed: (){
  32. Navigator.push(context, MaterialPageRoute(builder: (context) => Logo1() ));
  33. },),
  34. OutlineButton( child: Text("Page 2"), onPressed: (){
  35. Navigator.push(context, MaterialPageRoute(builder: (context) => Logo2() ));
  36. },)
  37. ],),
  38. Hero( child: FlutterLogo( size: 100.0,), tag: "fl",)
  39. ],),
  40. ),
  41. );
  42. }
  43. }
  44.  
  45. class Logo1 extends StatefulWidget {
  46. @override
  47. _Logo1State createState() => _Logo1State();
  48. }
  49.  
  50. class _Logo1State extends State<Logo1> {
  51. @override
  52. Widget build(BuildContext context) {
  53. return Scaffold(
  54. appBar: AppBar(title: Text("Logo 1"), centerTitle: true,),
  55. body: Hero(tag: "fl", child: FlutterLogo(style: FlutterLogoStyle.stacked, size: 300.0,)),
  56. );
  57. }
  58. }
  59.  
  60. class Logo2 extends StatefulWidget {
  61. @override
  62. _Logo2State createState() => _Logo2State();
  63. }
  64.  
  65. class _Logo2State extends State<Logo2> {
  66. @override
  67. Widget build(BuildContext context) {
  68. return Scaffold(
  69. appBar: AppBar(title: Text("Logo 2"), centerTitle: true,),
  70. body: Hero(tag: "fl", child: FlutterLogo(style: FlutterLogoStyle.horizontal, size: 300.0,)),
  71. );
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement