Skip to content

Instantly share code, notes, and snippets.

@collinjackson collinjackson/hero.dart
Last active Jun 26, 2018

Embed
What would you like to do?
Hero bug
// 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
You can’t perform that action at this time.