1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

[Shrine] New Shrine with expanding cart bottom sheet from experimenal (#18)

This commit is contained in:
Will Larche
2018-09-27 11:36:30 -04:00
committed by Andrew Brogdon
parent b5ce05e934
commit 4b4d5fef9c
11 changed files with 857 additions and 88 deletions

View File

@@ -103,7 +103,7 @@ class AppStateModel extends Model {
// Loads the list of available products from the repo.
void loadProducts() {
_availableProducts = ProductsRepository.loadProducts();
_availableProducts = ProductsRepository.loadProducts(Category.all);
notifyListeners();
}

View File

@@ -15,8 +15,8 @@
import 'product.dart';
class ProductsRepository {
static List<Product> loadProducts() {
return const [
static List<Product> loadProducts(Category category) {
const allProducts = <Product>[
Product(
category: Category.accessories,
id: 0,
@@ -284,5 +284,10 @@ class ProductsRepository {
price: 58,
),
];
if (category == Category.all) {
return allProducts;
} else {
return allProducts.where((Product p) => p.category == category).toList();
}
}
}