Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(Main());
- class Main extends StatefulWidget {
- @override
- _MainState createState() => _MainState();
- }
- class _MainState extends State<Main> {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: MyHero()
- );
- }
- }
- class MyHero extends StatefulWidget {
- @override
- _MyHeroState createState() => _MyHeroState();
- }
- class _MyHeroState extends State<MyHero> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(
- child: Column(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
- Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
- OutlineButton( child: Text("Page 1"), onPressed: (){
- Navigator.push(context, MaterialPageRoute(builder: (context) => Logo1() ));
- },),
- OutlineButton( child: Text("Page 2"), onPressed: (){
- Navigator.push(context, MaterialPageRoute(builder: (context) => Logo2() ));
- },)
- ],),
- Hero( child: FlutterLogo( size: 100.0,), tag: "fl",)
- ],),
- ),
- );
- }
- }
- class Logo1 extends StatefulWidget {
- @override
- _Logo1State createState() => _Logo1State();
- }
- class _Logo1State extends State<Logo1> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(title: Text("Logo 1"), centerTitle: true,),
- body: Hero(tag: "fl", child: FlutterLogo(style: FlutterLogoStyle.stacked, size: 300.0,)),
- );
- }
- }
- class Logo2 extends StatefulWidget {
- @override
- _Logo2State createState() => _Logo2State();
- }
- class _Logo2State extends State<Logo2> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(title: Text("Logo 2"), centerTitle: true,),
- body: Hero(tag: "fl", child: FlutterLogo(style: FlutterLogoStyle.horizontal, size: 300.0,)),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement