From ebaf9e29a045b2adbbacc204a978501301cf319d Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Mon, 13 Jun 2016 14:48:24 -0700 Subject: [PATCH] Gallery shrine demo uses image assets (#4544) --- dev/benchmarks/complex_layout/pubspec.yaml | 2 +- dev/manual_tests/pubspec.yaml | 2 +- examples/flutter_gallery/flutter.yaml | 21 +++++++++- .../lib/demo/shrine/shrine_data.dart | 38 +++++++++---------- .../lib/demo/shrine/shrine_home.dart | 10 ++--- .../lib/demo/shrine/shrine_order.dart | 8 ++-- .../lib/demo/shrine/shrine_types.dart | 6 +-- examples/flutter_gallery/pubspec.yaml | 2 +- 8 files changed, 54 insertions(+), 35 deletions(-) diff --git a/dev/benchmarks/complex_layout/pubspec.yaml b/dev/benchmarks/complex_layout/pubspec.yaml index eb4355ef69..1a39b7bbf7 100644 --- a/dev/benchmarks/complex_layout/pubspec.yaml +++ b/dev/benchmarks/complex_layout/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter_gallery_assets: git: url: https://flutter.googlesource.com/gallery-assets - ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 + ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9 dev_dependencies: flutter_test: diff --git a/dev/manual_tests/pubspec.yaml b/dev/manual_tests/pubspec.yaml index 35a922b938..134cef8208 100644 --- a/dev/manual_tests/pubspec.yaml +++ b/dev/manual_tests/pubspec.yaml @@ -9,7 +9,7 @@ dependencies: flutter_gallery_assets: git: url: https://flutter.googlesource.com/gallery-assets - ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 + ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9 dev_dependencies: test: any # flutter_test provides the version constraints diff --git a/examples/flutter_gallery/flutter.yaml b/examples/flutter_gallery/flutter.yaml index aff5c3c403..ecebf48146 100644 --- a/examples/flutter_gallery/flutter.yaml +++ b/examples/flutter_gallery/flutter.yaml @@ -8,6 +8,7 @@ assets: - assets/section_components.png - assets/section_patterns.png - assets/section_usability.png + - lib/gallery/example_code.dart - packages/flutter_gallery_assets/appbar_background.jpg - packages/flutter_gallery_assets/pesto/avatar.jpg - packages/flutter_gallery_assets/pesto/image10.jpg @@ -48,7 +49,25 @@ assets: - packages/flutter_gallery_assets/landscape_9.jpg - packages/flutter_gallery_assets/landscape_10.jpg - packages/flutter_gallery_assets/landscape_11.jpg - - lib/gallery/example_code.dart + - packages/flutter_gallery_assets/shrine/products/backpack.png + - packages/flutter_gallery_assets/shrine/products/beachball.png + - packages/flutter_gallery_assets/shrine/products/binoculars.png + - packages/flutter_gallery_assets/shrine/products/brush.png + - packages/flutter_gallery_assets/shrine/products/chair.png + - packages/flutter_gallery_assets/shrine/products/chucks.png + - packages/flutter_gallery_assets/shrine/products/clock.png + - packages/flutter_gallery_assets/shrine/products/fish_bowl.png + - packages/flutter_gallery_assets/shrine/products/flippers.png + - packages/flutter_gallery_assets/shrine/products/green-shoes.png + - packages/flutter_gallery_assets/shrine/products/heels.png + - packages/flutter_gallery_assets/shrine/products/helmet.png + - packages/flutter_gallery_assets/shrine/products/lawn_chair.png + - packages/flutter_gallery_assets/shrine/products/lipstick.png + - packages/flutter_gallery_assets/shrine/products/popsicle.png + - packages/flutter_gallery_assets/shrine/products/radio.png + - packages/flutter_gallery_assets/shrine/products/sunnies.png + - packages/flutter_gallery_assets/shrine/products/surfboard.png + - packages/flutter_gallery_assets/shrine/products/teapot.png - packages/flutter_gallery_assets/shrine/vendors/16c477b.jpg - packages/flutter_gallery_assets/shrine/vendors/ali-connors.png - packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart index 501ad4fa1a..0962c0bc82 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart @@ -51,7 +51,7 @@ const Vendor _stella = const Vendor( const List _allProducts = const [ const Product( name: 'Vintage Bluetooth Radio', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/radio.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/radio.png', categories: const ['furniture', 'latest'], price: 300.00, vendor: _sandra, @@ -62,7 +62,7 @@ const List _allProducts = const [ ), const Product( name: 'Sunglasses', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/sunnies.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/sunnies.png', categories: const ['travel', 'fashion', 'beauty'], price: 70.00, vendor: _trevor, @@ -74,7 +74,7 @@ const List _allProducts = const [ ), const Product( name: 'Clock', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/clock.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/clock.png', categories: const ['furniture'], price: 120.00, vendor: _trevor, @@ -85,7 +85,7 @@ const List _allProducts = const [ ), const Product( name: 'Red popsicle', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/popsicle.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/popsicle.png', categories: const ['food', 'fashion'], price: 300.00, vendor: _stella, @@ -96,7 +96,7 @@ const List _allProducts = const [ ), const Product( name: 'Folding Chair', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/lawn_chair.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/lawn_chair.png', categories: const ['furniture'], price: 63.00, vendor: _stella, @@ -105,7 +105,7 @@ const List _allProducts = const [ ), const Product( name: 'Green comfort chair', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/chair.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/chair.png', categories: const ['furniture'], price: 36.00, vendor: _ali, @@ -114,7 +114,7 @@ const List _allProducts = const [ ), const Product( name: 'Better wearing heels', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/heels.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/heels.png', categories: const ['fashion'], price: 125.00, vendor: _peter, @@ -123,7 +123,7 @@ const List _allProducts = const [ ), const Product( name: 'Green Slip-ons', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/green-shoes.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/green-shoes.png', categories: const ['travel', 'fashion'], price: 75.00, vendor: _sandra, @@ -134,7 +134,7 @@ const List _allProducts = const [ ), const Product( name: 'Teapot', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/teapot.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/teapot.png', categories: const ['furniture', 'fashion'], price: 210.00, vendor: _trevor, @@ -148,7 +148,7 @@ const List _allProducts = const [ ), const Product( name: 'Blue suede shoes', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/chucks.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/chucks.png', categories: const ['travel', 'fashion'], price: 89.00, vendor: _trevor, @@ -158,7 +158,7 @@ const List _allProducts = const [ ), const Product( name: 'Dipped Brush', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/brush.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/brush.png', categories: const ['fashion', 'beauty'], price: 25.00, vendor: _stella, @@ -169,7 +169,7 @@ const List _allProducts = const [ ), const Product( name: 'Perfect Goldfish Bowl', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/fish_bowl.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/fish_bowl.png', categories: const ['latest', 'furniture'], price: 25.00, vendor: _ali, @@ -180,7 +180,7 @@ const List _allProducts = const [ ), const Product( name: 'Red Lipstick Set', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/lipstick.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/lipstick.png', categories: const ['fashion', 'beauty'], price: 25.00, vendor: _sandra, @@ -191,7 +191,7 @@ const List _allProducts = const [ ), const Product( name: 'Backpack', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/backpack.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/backpack.png', categories: const ['travel', 'fashion'], price: 25.00, vendor: _peter, @@ -202,7 +202,7 @@ const List _allProducts = const [ ), const Product( name: 'Half Shield Helmet', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/helmet.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/helmet.png', categories: const ['travel', 'fashion', 'latest'], price: 25.00, vendor: _ali, @@ -213,7 +213,7 @@ const List _allProducts = const [ ), const Product( name: 'Beachball', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/beachball.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/beachball.png', categories: const ['latest'], price: 17.00, vendor: _peter, @@ -224,7 +224,7 @@ const List _allProducts = const [ ), const Product( name: 'Old Binoculars', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/binoculars.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/binoculars.png', categories: const ['travel', 'fashion', 'latest'], price: 25.00, vendor: _stella, @@ -236,7 +236,7 @@ const List _allProducts = const [ ), const Product( name: 'Lime Flippers', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/flippers.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/flippers.png', categories: const ['travel', 'fashion', 'beauty'], price: 25.00, vendor: _peter, @@ -247,7 +247,7 @@ const List _allProducts = const [ ), const Product( name: 'Surfboard', - imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/surfboard.png', + imageAsset: 'packages/flutter_gallery_assets/shrine/products/surfboard.png', categories: const [ 'travel', 'latest'], price: 25.00, vendor: _stella, diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart index c05edd410d..9ea440b130 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart @@ -140,9 +140,9 @@ class FeatureItem extends StatelessWidget { minHeight: 340.0, maxHeight: 340.0, alignment: FractionalOffset.topRight, - child: new NetworkImage( + child: new AssetImage( fit: ImageFit.cover, - src: product.imageUrl + name: product.imageAsset ) ) ) @@ -205,9 +205,9 @@ class ProductItem extends StatelessWidget { new Hero( tag: productHeroTag, key: new ObjectKey(product), - child: new NetworkImage( + child: new AssetImage( fit: ImageFit.contain, - src: product.imageUrl + name: product.imageAsset ) ), new Material( @@ -280,7 +280,7 @@ class _ShrineHomeState extends State { rowSpacing: 8.0, columnSpacing: 8.0, padding: const EdgeInsets.all(8.0), - tileAspectRatio: 160.0 / 216.0, // width/height + tileAspectRatio: 160.0 / 224.0, // width/height children: _products.map((Product product) { return new RepaintBoundary( child: new ProductItem( diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart index f8d002d8a7..ee70bca19f 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart @@ -41,9 +41,9 @@ class OrderItem extends StatelessWidget { height: 248.0, child: new Hero( tag: productHeroTag, - child: new NetworkImage( + child: new AssetImage( fit: ImageFit.contain, - src: product.imageUrl + name: product.imageAsset ) ) ) @@ -192,9 +192,9 @@ class _OrderPageState extends State { .map((Product product) { return new Card( elevation: 0, - child: new NetworkImage( + child: new AssetImage( fit: ImageFit.contain, - src: product.imageUrl + name: product.imageAsset ) ); }).toList() diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart index 693977cde7..d412350936 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart @@ -33,7 +33,7 @@ class Product { this.description, this.featureTitle, this.featureDescription, - this.imageUrl, + this.imageAsset, this.categories, this.price, this.vendor @@ -43,7 +43,7 @@ class Product { final String description; final String featureTitle; final String featureDescription; - final String imageUrl; + final String imageAsset; final List categories; final double price; final Vendor vendor; @@ -53,7 +53,7 @@ class Product { bool isValid() { return name != null && description != null && - imageUrl != null && + imageAsset != null && categories != null && categories.length > 0 && price != null && diff --git a/examples/flutter_gallery/pubspec.yaml b/examples/flutter_gallery/pubspec.yaml index 83b9105933..8e96bc78a4 100644 --- a/examples/flutter_gallery/pubspec.yaml +++ b/examples/flutter_gallery/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: flutter_gallery_assets: git: url: https://flutter.googlesource.com/gallery-assets - ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 + ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9 dev_dependencies: test: any # flutter_test provides the version constraints