Fixes for upcoming changes to avoid_classes_with_only_static_members (#86744)
This commit is contained in:
committed by
GitHub
parent
f3d8562c93
commit
b0e51db8d5
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_gallery/demo/shrine/model/product.dart';
|
||||
import 'package:flutter_gallery/demo/shrine/model/products_repository.dart';
|
||||
import 'package:flutter_gallery/demo/shrine/model/products_repository.dart' as product_repository;
|
||||
import 'package:scoped_model/scoped_model.dart';
|
||||
|
||||
double _salesTaxRate = 0.06;
|
||||
@@ -99,7 +99,7 @@ class AppStateModel extends Model {
|
||||
|
||||
// Loads the list of available products from the repo.
|
||||
void loadProducts() {
|
||||
_availableProducts = ProductsRepository.loadProducts(Category.all);
|
||||
_availableProducts = product_repository.loadProducts(Category.all);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,280 +4,278 @@
|
||||
|
||||
import 'package:flutter_gallery/demo/shrine/model/product.dart';
|
||||
|
||||
class ProductsRepository {
|
||||
static List<Product> loadProducts(Category category) {
|
||||
const List<Product> allProducts = <Product>[
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 0,
|
||||
isFeatured: true,
|
||||
name: 'Vagabond sack',
|
||||
price: 120,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 1,
|
||||
isFeatured: true,
|
||||
name: 'Stella sunglasses',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 2,
|
||||
isFeatured: false,
|
||||
name: 'Whitney belt',
|
||||
price: 35,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 3,
|
||||
isFeatured: true,
|
||||
name: 'Garden strand',
|
||||
price: 98,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 4,
|
||||
isFeatured: false,
|
||||
name: 'Strut earrings',
|
||||
price: 34,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 5,
|
||||
isFeatured: false,
|
||||
name: 'Varsity socks',
|
||||
price: 12,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 6,
|
||||
isFeatured: false,
|
||||
name: 'Weave keyring',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 7,
|
||||
isFeatured: true,
|
||||
name: 'Gatsby hat',
|
||||
price: 40,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 8,
|
||||
isFeatured: true,
|
||||
name: 'Shrug bag',
|
||||
price: 198,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 9,
|
||||
isFeatured: true,
|
||||
name: 'Gilt desk trio',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 10,
|
||||
isFeatured: false,
|
||||
name: 'Copper wire rack',
|
||||
price: 18,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 11,
|
||||
isFeatured: false,
|
||||
name: 'Soothe ceramic set',
|
||||
price: 28,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 12,
|
||||
isFeatured: false,
|
||||
name: 'Hurrahs tea set',
|
||||
price: 34,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 13,
|
||||
isFeatured: true,
|
||||
name: 'Blue stone mug',
|
||||
price: 18,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 14,
|
||||
isFeatured: true,
|
||||
name: 'Rainwater tray',
|
||||
price: 27,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 15,
|
||||
isFeatured: true,
|
||||
name: 'Chambray napkins',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 16,
|
||||
isFeatured: true,
|
||||
name: 'Succulent planters',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 17,
|
||||
isFeatured: false,
|
||||
name: 'Quartet table',
|
||||
price: 175,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 18,
|
||||
isFeatured: true,
|
||||
name: 'Kitchen quattro',
|
||||
price: 129,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 19,
|
||||
isFeatured: false,
|
||||
name: 'Clay sweater',
|
||||
price: 48,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 20,
|
||||
isFeatured: false,
|
||||
name: 'Sea tunic',
|
||||
price: 45,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 21,
|
||||
isFeatured: false,
|
||||
name: 'Plaster tunic',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 22,
|
||||
isFeatured: false,
|
||||
name: 'White pinstripe shirt',
|
||||
price: 70,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 23,
|
||||
isFeatured: false,
|
||||
name: 'Chambray shirt',
|
||||
price: 70,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 24,
|
||||
isFeatured: true,
|
||||
name: 'Seabreeze sweater',
|
||||
price: 60,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 25,
|
||||
isFeatured: false,
|
||||
name: 'Gentry jacket',
|
||||
price: 178,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 26,
|
||||
isFeatured: false,
|
||||
name: 'Navy trousers',
|
||||
price: 74,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 27,
|
||||
isFeatured: true,
|
||||
name: 'Walter henley (white)',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 28,
|
||||
isFeatured: true,
|
||||
name: 'Surf and perf shirt',
|
||||
price: 48,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 29,
|
||||
isFeatured: true,
|
||||
name: 'Ginger scarf',
|
||||
price: 98,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 30,
|
||||
isFeatured: true,
|
||||
name: 'Ramona crossover',
|
||||
price: 68,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 31,
|
||||
isFeatured: false,
|
||||
name: 'Chambray shirt',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 32,
|
||||
isFeatured: false,
|
||||
name: 'Classic white collar',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 33,
|
||||
isFeatured: true,
|
||||
name: 'Cerise scallop tee',
|
||||
price: 42,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 34,
|
||||
isFeatured: false,
|
||||
name: 'Shoulder rolls tee',
|
||||
price: 27,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 35,
|
||||
isFeatured: false,
|
||||
name: 'Grey slouch tank',
|
||||
price: 24,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 36,
|
||||
isFeatured: false,
|
||||
name: 'Sunshirt dress',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 37,
|
||||
isFeatured: true,
|
||||
name: 'Fine lines tee',
|
||||
price: 58,
|
||||
),
|
||||
];
|
||||
if (category == Category.all) {
|
||||
return allProducts;
|
||||
} else {
|
||||
return allProducts.where((Product p) => p.category == category).toList();
|
||||
}
|
||||
List<Product> loadProducts(Category category) {
|
||||
const List<Product> allProducts = <Product>[
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 0,
|
||||
isFeatured: true,
|
||||
name: 'Vagabond sack',
|
||||
price: 120,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 1,
|
||||
isFeatured: true,
|
||||
name: 'Stella sunglasses',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 2,
|
||||
isFeatured: false,
|
||||
name: 'Whitney belt',
|
||||
price: 35,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 3,
|
||||
isFeatured: true,
|
||||
name: 'Garden strand',
|
||||
price: 98,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 4,
|
||||
isFeatured: false,
|
||||
name: 'Strut earrings',
|
||||
price: 34,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 5,
|
||||
isFeatured: false,
|
||||
name: 'Varsity socks',
|
||||
price: 12,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 6,
|
||||
isFeatured: false,
|
||||
name: 'Weave keyring',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 7,
|
||||
isFeatured: true,
|
||||
name: 'Gatsby hat',
|
||||
price: 40,
|
||||
),
|
||||
Product(
|
||||
category: Category.accessories,
|
||||
id: 8,
|
||||
isFeatured: true,
|
||||
name: 'Shrug bag',
|
||||
price: 198,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 9,
|
||||
isFeatured: true,
|
||||
name: 'Gilt desk trio',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 10,
|
||||
isFeatured: false,
|
||||
name: 'Copper wire rack',
|
||||
price: 18,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 11,
|
||||
isFeatured: false,
|
||||
name: 'Soothe ceramic set',
|
||||
price: 28,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 12,
|
||||
isFeatured: false,
|
||||
name: 'Hurrahs tea set',
|
||||
price: 34,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 13,
|
||||
isFeatured: true,
|
||||
name: 'Blue stone mug',
|
||||
price: 18,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 14,
|
||||
isFeatured: true,
|
||||
name: 'Rainwater tray',
|
||||
price: 27,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 15,
|
||||
isFeatured: true,
|
||||
name: 'Chambray napkins',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 16,
|
||||
isFeatured: true,
|
||||
name: 'Succulent planters',
|
||||
price: 16,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 17,
|
||||
isFeatured: false,
|
||||
name: 'Quartet table',
|
||||
price: 175,
|
||||
),
|
||||
Product(
|
||||
category: Category.home,
|
||||
id: 18,
|
||||
isFeatured: true,
|
||||
name: 'Kitchen quattro',
|
||||
price: 129,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 19,
|
||||
isFeatured: false,
|
||||
name: 'Clay sweater',
|
||||
price: 48,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 20,
|
||||
isFeatured: false,
|
||||
name: 'Sea tunic',
|
||||
price: 45,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 21,
|
||||
isFeatured: false,
|
||||
name: 'Plaster tunic',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 22,
|
||||
isFeatured: false,
|
||||
name: 'White pinstripe shirt',
|
||||
price: 70,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 23,
|
||||
isFeatured: false,
|
||||
name: 'Chambray shirt',
|
||||
price: 70,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 24,
|
||||
isFeatured: true,
|
||||
name: 'Seabreeze sweater',
|
||||
price: 60,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 25,
|
||||
isFeatured: false,
|
||||
name: 'Gentry jacket',
|
||||
price: 178,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 26,
|
||||
isFeatured: false,
|
||||
name: 'Navy trousers',
|
||||
price: 74,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 27,
|
||||
isFeatured: true,
|
||||
name: 'Walter henley (white)',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 28,
|
||||
isFeatured: true,
|
||||
name: 'Surf and perf shirt',
|
||||
price: 48,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 29,
|
||||
isFeatured: true,
|
||||
name: 'Ginger scarf',
|
||||
price: 98,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 30,
|
||||
isFeatured: true,
|
||||
name: 'Ramona crossover',
|
||||
price: 68,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 31,
|
||||
isFeatured: false,
|
||||
name: 'Chambray shirt',
|
||||
price: 38,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 32,
|
||||
isFeatured: false,
|
||||
name: 'Classic white collar',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 33,
|
||||
isFeatured: true,
|
||||
name: 'Cerise scallop tee',
|
||||
price: 42,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 34,
|
||||
isFeatured: false,
|
||||
name: 'Shoulder rolls tee',
|
||||
price: 27,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 35,
|
||||
isFeatured: false,
|
||||
name: 'Grey slouch tank',
|
||||
price: 24,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 36,
|
||||
isFeatured: false,
|
||||
name: 'Sunshirt dress',
|
||||
price: 58,
|
||||
),
|
||||
Product(
|
||||
category: Category.clothing,
|
||||
id: 37,
|
||||
isFeatured: true,
|
||||
name: 'Fine lines tee',
|
||||
price: 58,
|
||||
),
|
||||
];
|
||||
if (category == Category.all) {
|
||||
return allProducts;
|
||||
} else {
|
||||
return allProducts.where((Product p) => p.category == category).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,10 @@ Future<PortForwarder> _dummyPortForwardingFunction(
|
||||
/// `FUCHSIA_SSH_CONFIG` variables must be set. If run on a Fuchsia device, will
|
||||
/// connect locally without need for environment variables.
|
||||
class FuchsiaCompat {
|
||||
// This class is not meant to be instantiated or extended; this constructor
|
||||
// prevents instantiation and extension.
|
||||
FuchsiaCompat._();
|
||||
|
||||
static void _init() {
|
||||
fuchsiaPortForwardingFunction = _dummyPortForwardingFunction;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ String _keyLabel(LogicalKeyboardKey key) {
|
||||
/// A class that serves as a namespace for a bunch of keyboard-key generation
|
||||
/// utilities.
|
||||
class KeyEventSimulator {
|
||||
// This class is not meant to be instantiated or extended; this constructor
|
||||
// prevents instantiation and extension.
|
||||
KeyEventSimulator._();
|
||||
|
||||
// Look up a synonym key, and just return the left version of it.
|
||||
static LogicalKeyboardKey _getKeySynonym(LogicalKeyboardKey origKey) {
|
||||
if (origKey == LogicalKeyboardKey.shift) {
|
||||
|
||||
Reference in New Issue
Block a user