Last active
June 26, 2018 08:03
-
-
Save collinjackson/6a46f0b471a7a9a82c19 to your computer and use it in GitHub Desktop.
Hero bug
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
// Copyright (c) 2015, the Flutter project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/animation.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
import 'package:flutter/services.dart'; | |
void main() { | |
timeDilation = 8.0; | |
runApp( | |
new MaterialApp( | |
title: "Hero Issue Repro", | |
routes: { | |
'/': (RouteArguments args) => new HeroDemo(), | |
'/other': (RouteArguments args) => new OtherPage(), | |
} | |
) | |
); | |
} | |
class HeroDemo extends StatelessComponent { | |
Widget build(BuildContext context) { | |
return new Block([ | |
new Container( | |
height: 500.0, | |
decoration: const BoxDecoration(backgroundColor: const Color(0xFF00FFFF)) | |
), | |
new Block( | |
[ | |
new Hero( | |
child: new GestureDetector( | |
onTap: () => Navigator.of(context).pushNamed("/other"), | |
child: new Container( | |
height: 300.0, | |
decoration: const BoxDecoration(backgroundColor: const Color(0xFFFF00FF)) | |
) | |
), | |
tag: "test", | |
key: new Key("test") | |
), | |
] | |
), | |
]); | |
} | |
} | |
class OtherPage extends StatelessComponent { | |
Widget build(BuildContext context) { | |
return new Block( | |
[ | |
new Hero( | |
child: new Container( | |
height: 300.0, | |
decoration: const BoxDecoration(backgroundColor: const Color(0xFFFF00FF)) | |
), | |
tag: "test", | |
key: new Key("test") | |
), | |
new Container( | |
height: 800.0, | |
decoration: const BoxDecoration(backgroundColor: const Color(0xFF333333)) | |
) | |
] | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment