Created
July 18, 2019 06:51
-
-
Save ShivamGoyal1899/9abd874cfaf68ba823756b35ca005336 to your computer and use it in GitHub Desktop.
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
switch (index) { | |
case 0: | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16), | |
child: _buildNameField(), | |
); | |
case 1: | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16), | |
child: _buildEmailField(), | |
); | |
case 2: | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 16), | |
child: _buildLocationField(), | |
); | |
case 3: | |
return Padding( | |
padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), | |
child: _buildDateAndTimePicker(context), | |
); | |
default: // NEW FROM HERE | |
if (model.productsInCart.length > productIndex) { | |
return ShoppingCartItem( | |
index: index, | |
product: model.getProductById( | |
model.productsInCart.keys.toList()[productIndex]), | |
quantity: model.productsInCart.values.toList()[productIndex], | |
lastItem: productIndex == model.productsInCart.length - 1, | |
formatter: _currencyFormat, | |
); | |
} else if (model.productsInCart.keys.length == productIndex && | |
model.productsInCart.isNotEmpty) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 20), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.end, | |
children: <Widget>[ | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.end, | |
children: <Widget>[ | |
Text( | |
'Shipping ' | |
'${_currencyFormat.format(model.shippingCost)}', | |
style: Styles.productRowItemPrice, | |
), | |
const SizedBox(height: 6), | |
Text( | |
'Tax ${_currencyFormat.format(model.tax)}', | |
style: Styles.productRowItemPrice, | |
), | |
const SizedBox(height: 6), | |
Text( | |
'Total ${_currencyFormat.format(model.totalCost)}', | |
style: Styles.productRowTotal, | |
), | |
], | |
) | |
], | |
), | |
); | |
} | |
} // TO HERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment