"Fossies" - the Fresh Open Source Software Archive

Member "flutter-1.22.4/dev/integration_tests/flutter_gallery/lib/demo/shrine/model/products_repository.dart" (13 Nov 2020, 6421 Bytes) of package /linux/misc/flutter-1.22.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2014 The Flutter Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
    4 
    5 import 'package:flutter_gallery/demo/shrine/model/product.dart';
    6 
    7 class ProductsRepository {
    8   static List<Product> loadProducts(Category category) {
    9     const List<Product> allProducts = <Product>[
   10       Product(
   11         category: Category.accessories,
   12         id: 0,
   13         isFeatured: true,
   14         name: 'Vagabond sack',
   15         price: 120,
   16       ),
   17       Product(
   18         category: Category.accessories,
   19         id: 1,
   20         isFeatured: true,
   21         name: 'Stella sunglasses',
   22         price: 58,
   23       ),
   24       Product(
   25         category: Category.accessories,
   26         id: 2,
   27         isFeatured: false,
   28         name: 'Whitney belt',
   29         price: 35,
   30       ),
   31       Product(
   32         category: Category.accessories,
   33         id: 3,
   34         isFeatured: true,
   35         name: 'Garden strand',
   36         price: 98,
   37       ),
   38       Product(
   39         category: Category.accessories,
   40         id: 4,
   41         isFeatured: false,
   42         name: 'Strut earrings',
   43         price: 34,
   44       ),
   45       Product(
   46         category: Category.accessories,
   47         id: 5,
   48         isFeatured: false,
   49         name: 'Varsity socks',
   50         price: 12,
   51       ),
   52       Product(
   53         category: Category.accessories,
   54         id: 6,
   55         isFeatured: false,
   56         name: 'Weave keyring',
   57         price: 16,
   58       ),
   59       Product(
   60         category: Category.accessories,
   61         id: 7,
   62         isFeatured: true,
   63         name: 'Gatsby hat',
   64         price: 40,
   65       ),
   66       Product(
   67         category: Category.accessories,
   68         id: 8,
   69         isFeatured: true,
   70         name: 'Shrug bag',
   71         price: 198,
   72       ),
   73       Product(
   74         category: Category.home,
   75         id: 9,
   76         isFeatured: true,
   77         name: 'Gilt desk trio',
   78         price: 58,
   79       ),
   80       Product(
   81         category: Category.home,
   82         id: 10,
   83         isFeatured: false,
   84         name: 'Copper wire rack',
   85         price: 18,
   86       ),
   87       Product(
   88         category: Category.home,
   89         id: 11,
   90         isFeatured: false,
   91         name: 'Soothe ceramic set',
   92         price: 28,
   93       ),
   94       Product(
   95         category: Category.home,
   96         id: 12,
   97         isFeatured: false,
   98         name: 'Hurrahs tea set',
   99         price: 34,
  100       ),
  101       Product(
  102         category: Category.home,
  103         id: 13,
  104         isFeatured: true,
  105         name: 'Blue stone mug',
  106         price: 18,
  107       ),
  108       Product(
  109         category: Category.home,
  110         id: 14,
  111         isFeatured: true,
  112         name: 'Rainwater tray',
  113         price: 27,
  114       ),
  115       Product(
  116         category: Category.home,
  117         id: 15,
  118         isFeatured: true,
  119         name: 'Chambray napkins',
  120         price: 16,
  121       ),
  122       Product(
  123         category: Category.home,
  124         id: 16,
  125         isFeatured: true,
  126         name: 'Succulent planters',
  127         price: 16,
  128       ),
  129       Product(
  130         category: Category.home,
  131         id: 17,
  132         isFeatured: false,
  133         name: 'Quartet table',
  134         price: 175,
  135       ),
  136       Product(
  137         category: Category.home,
  138         id: 18,
  139         isFeatured: true,
  140         name: 'Kitchen quattro',
  141         price: 129,
  142       ),
  143       Product(
  144         category: Category.clothing,
  145         id: 19,
  146         isFeatured: false,
  147         name: 'Clay sweater',
  148         price: 48,
  149       ),
  150       Product(
  151         category: Category.clothing,
  152         id: 20,
  153         isFeatured: false,
  154         name: 'Sea tunic',
  155         price: 45,
  156       ),
  157       Product(
  158         category: Category.clothing,
  159         id: 21,
  160         isFeatured: false,
  161         name: 'Plaster tunic',
  162         price: 38,
  163       ),
  164       Product(
  165         category: Category.clothing,
  166         id: 22,
  167         isFeatured: false,
  168         name: 'White pinstripe shirt',
  169         price: 70,
  170       ),
  171       Product(
  172         category: Category.clothing,
  173         id: 23,
  174         isFeatured: false,
  175         name: 'Chambray shirt',
  176         price: 70,
  177       ),
  178       Product(
  179         category: Category.clothing,
  180         id: 24,
  181         isFeatured: true,
  182         name: 'Seabreeze sweater',
  183         price: 60,
  184       ),
  185       Product(
  186         category: Category.clothing,
  187         id: 25,
  188         isFeatured: false,
  189         name: 'Gentry jacket',
  190         price: 178,
  191       ),
  192       Product(
  193         category: Category.clothing,
  194         id: 26,
  195         isFeatured: false,
  196         name: 'Navy trousers',
  197         price: 74,
  198       ),
  199       Product(
  200         category: Category.clothing,
  201         id: 27,
  202         isFeatured: true,
  203         name: 'Walter henley (white)',
  204         price: 38,
  205       ),
  206       Product(
  207         category: Category.clothing,
  208         id: 28,
  209         isFeatured: true,
  210         name: 'Surf and perf shirt',
  211         price: 48,
  212       ),
  213       Product(
  214         category: Category.clothing,
  215         id: 29,
  216         isFeatured: true,
  217         name: 'Ginger scarf',
  218         price: 98,
  219       ),
  220       Product(
  221         category: Category.clothing,
  222         id: 30,
  223         isFeatured: true,
  224         name: 'Ramona crossover',
  225         price: 68,
  226       ),
  227       Product(
  228         category: Category.clothing,
  229         id: 31,
  230         isFeatured: false,
  231         name: 'Chambray shirt',
  232         price: 38,
  233       ),
  234       Product(
  235         category: Category.clothing,
  236         id: 32,
  237         isFeatured: false,
  238         name: 'Classic white collar',
  239         price: 58,
  240       ),
  241       Product(
  242         category: Category.clothing,
  243         id: 33,
  244         isFeatured: true,
  245         name: 'Cerise scallop tee',
  246         price: 42,
  247       ),
  248       Product(
  249         category: Category.clothing,
  250         id: 34,
  251         isFeatured: false,
  252         name: 'Shoulder rolls tee',
  253         price: 27,
  254       ),
  255       Product(
  256         category: Category.clothing,
  257         id: 35,
  258         isFeatured: false,
  259         name: 'Grey slouch tank',
  260         price: 24,
  261       ),
  262       Product(
  263         category: Category.clothing,
  264         id: 36,
  265         isFeatured: false,
  266         name: 'Sunshirt dress',
  267         price: 58,
  268       ),
  269       Product(
  270         category: Category.clothing,
  271         id: 37,
  272         isFeatured: true,
  273         name: 'Fine lines tee',
  274         price: 58,
  275       ),
  276     ];
  277     if (category == Category.all) {
  278       return allProducts;
  279     } else {
  280       return allProducts.where((Product p) => p.category == category).toList();
  281     }
  282   }
  283 }