Commit 6e62df42 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed unnecessary Shrine hero logic (#5394)

* Removed unnecessary Shrine hero logic
parent 955b3e21
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:collection' show HashSet;
import 'package:flutter/material.dart';
......@@ -265,8 +264,7 @@ class ProductItem extends StatelessWidget {
height: 144.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Hero(
tag: productHeroTag,
key: new ObjectKey(product),
tag: product.tag,
child: new Image.asset(product.imageAsset, fit: ImageFit.contain)
)
),
......@@ -306,12 +304,8 @@ class _ShrineHomeState extends State<ShrineHome> {
void showOrderPage(Product product) {
final Order order = _shoppingCart[product] ?? new Order(product: product);
final Completer<Order> completer = new Completer<Order>();
final Key productKey = new ObjectKey(product);
final Set<Key> mostValuableKeys = new HashSet<Key>();
mostValuableKeys.add(productKey);
Navigator.push(context, new ShrineOrderRoute(
order: order,
settings: new RouteSettings(mostValuableKeys: mostValuableKeys),
completer: completer,
builder: (BuildContext context) {
return new OrderPage(
......
......@@ -40,7 +40,7 @@ class OrderItem extends StatelessWidget {
width: 248.0,
height: 248.0,
child: new Hero(
tag: productHeroTag,
tag: product.tag,
child: new Image.asset(product.imageAsset, fit: ImageFit.contain)
)
)
......
......@@ -4,8 +4,6 @@
import 'dart:ui' show hashValues;
const String productHeroTag = 'Product';
class Vendor {
const Vendor({
this.name,
......@@ -48,6 +46,7 @@ class Product {
final double price;
final Vendor vendor;
String get tag => name; // Unique value for Heroes
String get priceString => '\$${price.floor()}';
bool isValid() {
......
......@@ -387,7 +387,7 @@ class HeroParty {
assert(to == null || to.sourceStates.length == 1);
assert(to == null || to.currentTurns.floor() == to.currentTurns);
HeroState targetState = to != null ? to.sourceStates.elementAt(0) : null;
Set<HeroState> sourceStates = from != null ? from.sourceStates : new HashSet<HeroState>();
Set<HeroState> sourceStates = from?.sourceStates ?? new HashSet<HeroState>();
sourceStates.remove(targetState);
Rect sourceRect = from?.currentRect ?? to.currentRect.center & Size.zero;
Rect targetRect = to?.currentRect ?? from.currentRect.center & Size.zero;
......@@ -545,7 +545,7 @@ class HeroController extends NavigatorObserver {
void _updateQuest(Duration timeStamp) {
if (navigator == null) {
// The navigator has been removed for this end-of-frame callback was called.
// The navigator was removed before this end-of-frame callback was called.
return;
}
Set<Key> mostValuableKeys = _getMostValuableKeys();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment