Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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