Unverified Commit b0e51db8 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Fixes for upcoming changes to avoid_classes_with_only_static_members (#86744)

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