This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'product.dart'; | |
class ProductsRepository { | |
static const _allProducts = <Product>[ | |
Product( | |
category: Category.accessories, | |
id: 0, | |
isFeatured: true, | |
name: 'Vagabond sack', | |
price: 120, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/foundation.dart'; | |
enum Category { | |
all, | |
accessories, | |
clothing, | |
home, | |
} | |
class Product { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'product_list_tab.dart'; // NEW | |
import 'search_tab.dart'; // NEW | |
import 'shopping_cart_tab.dart'; // NEW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:provider/provider.dart'; | |
import 'model/app_state_model.dart'; | |
class ShoppingCartTab extends StatefulWidget { | |
@override | |
_ShoppingCartTabState createState() { | |
return _ShoppingCartTabState(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
class SearchTab extends StatefulWidget { | |
@override | |
_SearchTabState createState() { | |
return _SearchTabState(); | |
} | |
} | |
class _SearchTabState extends State<SearchTab> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:provider/provider.dart'; | |
import 'model/app_state_model.dart'; | |
class ProductListTab extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Consumer<AppStateModel>( | |
builder: (context, model, child) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CupertinoStoreHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoTabScaffold( | |
tabBar: CupertinoTabBar( | |
items: const <BottomNavigationBarItem>[ | |
BottomNavigationBarItem( | |
icon: Icon(CupertinoIcons.home), | |
title: Text('Products'), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cupertino_store | |
description: Creating a Store in Cupertino widgets | |
version: 1.0.0+1 | |
environment: | |
sdk: ^2.4.0 | |
flutter: ^1.7.0 | |
dependencies: | |
flutter: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CupertinoStoreHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoPageScaffold( | |
navigationBar: CupertinoNavigationBar( | |
middle: const Text('Cupertino Store'), | |
), | |
child: Container(), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'styles.dart'; | |
class CupertinoStoreApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoApp( | |
home: CupertinoStoreHomePage(), | |
); | |
} |