Commit ebaf9e29 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Gallery shrine demo uses image assets (#4544)

parent 2cdda9e6
...@@ -11,7 +11,7 @@ dependencies: ...@@ -11,7 +11,7 @@ dependencies:
flutter_gallery_assets: flutter_gallery_assets:
git: git:
url: https://flutter.googlesource.com/gallery-assets url: https://flutter.googlesource.com/gallery-assets
ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
...@@ -9,7 +9,7 @@ dependencies: ...@@ -9,7 +9,7 @@ dependencies:
flutter_gallery_assets: flutter_gallery_assets:
git: git:
url: https://flutter.googlesource.com/gallery-assets url: https://flutter.googlesource.com/gallery-assets
ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9
dev_dependencies: dev_dependencies:
test: any # flutter_test provides the version constraints test: any # flutter_test provides the version constraints
......
...@@ -8,6 +8,7 @@ assets: ...@@ -8,6 +8,7 @@ assets:
- assets/section_components.png - assets/section_components.png
- assets/section_patterns.png - assets/section_patterns.png
- assets/section_usability.png - assets/section_usability.png
- lib/gallery/example_code.dart
- packages/flutter_gallery_assets/appbar_background.jpg - packages/flutter_gallery_assets/appbar_background.jpg
- packages/flutter_gallery_assets/pesto/avatar.jpg - packages/flutter_gallery_assets/pesto/avatar.jpg
- packages/flutter_gallery_assets/pesto/image10.jpg - packages/flutter_gallery_assets/pesto/image10.jpg
...@@ -48,7 +49,25 @@ assets: ...@@ -48,7 +49,25 @@ assets:
- packages/flutter_gallery_assets/landscape_9.jpg - packages/flutter_gallery_assets/landscape_9.jpg
- packages/flutter_gallery_assets/landscape_10.jpg - packages/flutter_gallery_assets/landscape_10.jpg
- packages/flutter_gallery_assets/landscape_11.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/16c477b.jpg
- packages/flutter_gallery_assets/shrine/vendors/ali-connors.png - packages/flutter_gallery_assets/shrine/vendors/ali-connors.png
- packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png - packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png
......
...@@ -51,7 +51,7 @@ const Vendor _stella = const Vendor( ...@@ -51,7 +51,7 @@ const Vendor _stella = const Vendor(
const List<Product> _allProducts = const <Product> [ const List<Product> _allProducts = const <Product> [
const Product( const Product(
name: 'Vintage Bluetooth Radio', 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 <String>['furniture', 'latest'], categories: const <String>['furniture', 'latest'],
price: 300.00, price: 300.00,
vendor: _sandra, vendor: _sandra,
...@@ -62,7 +62,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -62,7 +62,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Sunglasses', name: 'Sunglasses',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/sunnies.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/sunnies.png',
categories: const <String>['travel', 'fashion', 'beauty'], categories: const <String>['travel', 'fashion', 'beauty'],
price: 70.00, price: 70.00,
vendor: _trevor, vendor: _trevor,
...@@ -74,7 +74,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -74,7 +74,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Clock', name: 'Clock',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/clock.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/clock.png',
categories: const <String>['furniture'], categories: const <String>['furniture'],
price: 120.00, price: 120.00,
vendor: _trevor, vendor: _trevor,
...@@ -85,7 +85,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -85,7 +85,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Red popsicle', 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 <String>['food', 'fashion'], categories: const <String>['food', 'fashion'],
price: 300.00, price: 300.00,
vendor: _stella, vendor: _stella,
...@@ -96,7 +96,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -96,7 +96,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Folding Chair', 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 <String>['furniture'], categories: const <String>['furniture'],
price: 63.00, price: 63.00,
vendor: _stella, vendor: _stella,
...@@ -105,7 +105,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -105,7 +105,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Green comfort chair', 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 <String>['furniture'], categories: const <String>['furniture'],
price: 36.00, price: 36.00,
vendor: _ali, vendor: _ali,
...@@ -114,7 +114,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -114,7 +114,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Better wearing heels', 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 <String>['fashion'], categories: const <String>['fashion'],
price: 125.00, price: 125.00,
vendor: _peter, vendor: _peter,
...@@ -123,7 +123,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -123,7 +123,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Green Slip-ons', 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 <String>['travel', 'fashion'], categories: const <String>['travel', 'fashion'],
price: 75.00, price: 75.00,
vendor: _sandra, vendor: _sandra,
...@@ -134,7 +134,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -134,7 +134,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Teapot', name: 'Teapot',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/teapot.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/teapot.png',
categories: const <String>['furniture', 'fashion'], categories: const <String>['furniture', 'fashion'],
price: 210.00, price: 210.00,
vendor: _trevor, vendor: _trevor,
...@@ -148,7 +148,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -148,7 +148,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Blue suede shoes', 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 <String>['travel', 'fashion'], categories: const <String>['travel', 'fashion'],
price: 89.00, price: 89.00,
vendor: _trevor, vendor: _trevor,
...@@ -158,7 +158,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -158,7 +158,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Dipped Brush', 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 <String>['fashion', 'beauty'], categories: const <String>['fashion', 'beauty'],
price: 25.00, price: 25.00,
vendor: _stella, vendor: _stella,
...@@ -169,7 +169,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -169,7 +169,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Perfect Goldfish Bowl', 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 <String>['latest', 'furniture'], categories: const <String>['latest', 'furniture'],
price: 25.00, price: 25.00,
vendor: _ali, vendor: _ali,
...@@ -180,7 +180,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -180,7 +180,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Red Lipstick Set', 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 <String>['fashion', 'beauty'], categories: const <String>['fashion', 'beauty'],
price: 25.00, price: 25.00,
vendor: _sandra, vendor: _sandra,
...@@ -191,7 +191,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -191,7 +191,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Backpack', name: 'Backpack',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/backpack.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/backpack.png',
categories: const <String>['travel', 'fashion'], categories: const <String>['travel', 'fashion'],
price: 25.00, price: 25.00,
vendor: _peter, vendor: _peter,
...@@ -202,7 +202,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -202,7 +202,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Half Shield Helmet', 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 <String>['travel', 'fashion', 'latest'], categories: const <String>['travel', 'fashion', 'latest'],
price: 25.00, price: 25.00,
vendor: _ali, vendor: _ali,
...@@ -213,7 +213,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -213,7 +213,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Beachball', name: 'Beachball',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/beachball.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/beachball.png',
categories: const <String>['latest'], categories: const <String>['latest'],
price: 17.00, price: 17.00,
vendor: _peter, vendor: _peter,
...@@ -224,7 +224,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -224,7 +224,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Old Binoculars', 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 <String>['travel', 'fashion', 'latest'], categories: const <String>['travel', 'fashion', 'latest'],
price: 25.00, price: 25.00,
vendor: _stella, vendor: _stella,
...@@ -236,7 +236,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -236,7 +236,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Lime Flippers', 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 <String>['travel', 'fashion', 'beauty'], categories: const <String>['travel', 'fashion', 'beauty'],
price: 25.00, price: 25.00,
vendor: _peter, vendor: _peter,
...@@ -247,7 +247,7 @@ const List<Product> _allProducts = const <Product> [ ...@@ -247,7 +247,7 @@ const List<Product> _allProducts = const <Product> [
), ),
const Product( const Product(
name: 'Surfboard', name: 'Surfboard',
imageUrl: 'https://www.gstatic.com/angular/material-adaptive/shrine/surfboard.png', imageAsset: 'packages/flutter_gallery_assets/shrine/products/surfboard.png',
categories: const <String>[ 'travel', 'latest'], categories: const <String>[ 'travel', 'latest'],
price: 25.00, price: 25.00,
vendor: _stella, vendor: _stella,
......
...@@ -140,9 +140,9 @@ class FeatureItem extends StatelessWidget { ...@@ -140,9 +140,9 @@ class FeatureItem extends StatelessWidget {
minHeight: 340.0, minHeight: 340.0,
maxHeight: 340.0, maxHeight: 340.0,
alignment: FractionalOffset.topRight, alignment: FractionalOffset.topRight,
child: new NetworkImage( child: new AssetImage(
fit: ImageFit.cover, fit: ImageFit.cover,
src: product.imageUrl name: product.imageAsset
) )
) )
) )
...@@ -205,9 +205,9 @@ class ProductItem extends StatelessWidget { ...@@ -205,9 +205,9 @@ class ProductItem extends StatelessWidget {
new Hero( new Hero(
tag: productHeroTag, tag: productHeroTag,
key: new ObjectKey(product), key: new ObjectKey(product),
child: new NetworkImage( child: new AssetImage(
fit: ImageFit.contain, fit: ImageFit.contain,
src: product.imageUrl name: product.imageAsset
) )
), ),
new Material( new Material(
...@@ -280,7 +280,7 @@ class _ShrineHomeState extends State<ShrineHome> { ...@@ -280,7 +280,7 @@ class _ShrineHomeState extends State<ShrineHome> {
rowSpacing: 8.0, rowSpacing: 8.0,
columnSpacing: 8.0, columnSpacing: 8.0,
padding: const EdgeInsets.all(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) { children: _products.map((Product product) {
return new RepaintBoundary( return new RepaintBoundary(
child: new ProductItem( child: new ProductItem(
......
...@@ -41,9 +41,9 @@ class OrderItem extends StatelessWidget { ...@@ -41,9 +41,9 @@ class OrderItem extends StatelessWidget {
height: 248.0, height: 248.0,
child: new Hero( child: new Hero(
tag: productHeroTag, tag: productHeroTag,
child: new NetworkImage( child: new AssetImage(
fit: ImageFit.contain, fit: ImageFit.contain,
src: product.imageUrl name: product.imageAsset
) )
) )
) )
...@@ -192,9 +192,9 @@ class _OrderPageState extends State<OrderPage> { ...@@ -192,9 +192,9 @@ class _OrderPageState extends State<OrderPage> {
.map((Product product) { .map((Product product) {
return new Card( return new Card(
elevation: 0, elevation: 0,
child: new NetworkImage( child: new AssetImage(
fit: ImageFit.contain, fit: ImageFit.contain,
src: product.imageUrl name: product.imageAsset
) )
); );
}).toList() }).toList()
......
...@@ -33,7 +33,7 @@ class Product { ...@@ -33,7 +33,7 @@ class Product {
this.description, this.description,
this.featureTitle, this.featureTitle,
this.featureDescription, this.featureDescription,
this.imageUrl, this.imageAsset,
this.categories, this.categories,
this.price, this.price,
this.vendor this.vendor
...@@ -43,7 +43,7 @@ class Product { ...@@ -43,7 +43,7 @@ class Product {
final String description; final String description;
final String featureTitle; final String featureTitle;
final String featureDescription; final String featureDescription;
final String imageUrl; final String imageAsset;
final List<String> categories; final List<String> categories;
final double price; final double price;
final Vendor vendor; final Vendor vendor;
...@@ -53,7 +53,7 @@ class Product { ...@@ -53,7 +53,7 @@ class Product {
bool isValid() { bool isValid() {
return name != null && return name != null &&
description != null && description != null &&
imageUrl != null && imageAsset != null &&
categories != null && categories != null &&
categories.length > 0 && categories.length > 0 &&
price != null && price != null &&
......
...@@ -13,7 +13,7 @@ dependencies: ...@@ -13,7 +13,7 @@ dependencies:
flutter_gallery_assets: flutter_gallery_assets:
git: git:
url: https://flutter.googlesource.com/gallery-assets url: https://flutter.googlesource.com/gallery-assets
ref: ea2c9c344c8b6b318341590e2af0707f8a6649f1 ref: 3e55082f0128cb4ef95e0e8d2c14e941024d6da9
dev_dependencies: dev_dependencies:
test: any # flutter_test provides the version constraints test: any # flutter_test provides the version constraints
......
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