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 _ShoppingCartTabState extends State<ShoppingCartTab> { | |
String name; // ADD FROM HERE | |
String email; | |
String location; | |
String pin; | |
DateTime dateTime = DateTime.now(); | |
Widget _buildNameField() { | |
return CupertinoTextField( | |
prefix: const Icon( |
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:flutter/widgets.dart'; | |
import 'styles.dart'; | |
class SearchBar extends StatelessWidget { | |
const SearchBar({ | |
@required this.controller, | |
@required this.focusNode, | |
}); |
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 _SearchTabState extends State<SearchTab> { | |
TextEditingController _controller; | |
FocusNode _focusNode; | |
String _terms = ''; | |
@override | |
void initState() { | |
super.initState(); | |
_controller = TextEditingController()..addListener(_onTextChanged); | |
_focusNode = FocusNode(); |
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 _SearchTabState extends State<SearchTab> { | |
// ... | |
@override | |
Widget build(BuildContext context) { | |
final model = Provider.of<AppStateModel>(context); | |
final results = model.search(_terms); | |
return DecoratedBox( | |
decoration: const BoxDecoration( |
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' | |
import 'product_row_item.dart' | |
import 'search_bar.dart' | |
import 'styles.dart' |
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 ProductListTab extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoPageScaffold( | |
child: Consumer<AppStateModel>( | |
builder: (context, child, model) { | |
final products = model.getProducts(); | |
return CustomScrollView( | |
semanticChildCount: products.length, | |
slivers: <Widget>[ |
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 ProductListTab extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoPageScaffold( | |
child: Consumer<AppStateModel>( | |
builder: (context, child, model) { | |
final products = model.getProducts(); // NEW | |
return CustomScrollView( | |
semanticChildCount: products.length, // NEW | |
slivers: <Widget>[ |
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'; | |
import 'model/product.dart'; | |
import 'styles.dart'; | |
class ProductRowItem extends StatelessWidget { | |
const ProductRowItem({ | |
this.index, |
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:flutter/services.dart'; | |
import 'package:provider/provider.dart'; // NEW | |
import 'app.dart'; | |
import 'model/app_state_model.dart'; // NEW | |
void main() { | |
SystemChrome.setPreferredOrientations( | |
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); |
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' as foundation; | |
import 'product.dart'; | |
import 'products_repository.dart'; | |
double _salesTaxRate = 0.06; | |
double _shippingCostPerItem = 7; | |
class AppStateModel extends foundation.ChangeNotifier { | |
// All the available products. |