Implementation
pricingTable(Function(String) _get){
List<Widget> list = [];
list.add(SizedBox(height: 5,));
list.add(Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black));
list.add(SizedBox(height: 5,));
list.add(Row(
children: [
Expanded(child: Text(_get("subtotal"), style: aTheme.style12W400)),
Text(getPriceString(price.getPrice()*productData.countProduct), style: aTheme.style14W800,)
],
));
list.add(SizedBox(height: 5,));
list.add(Text(_get("addons") , style: aTheme.style12W600Grey,),);
list.add(SizedBox(height: 10,));
bool _found = false;
for (var item in productData.addon) {
if (!item.selected)
continue;
list.add(Container(
margin: _get("direction") == TextDirection.ltr ? EdgeInsets.only(left: 20) : EdgeInsets.only(right: 20),
child: Row(
children: [
Expanded(child: Text("${getTextByLocale(item.name, _get("locale"))} ${item.needCount}x${getPriceString(item.price)}",
style: aTheme.style12W400,)),
SizedBox(width: 5,),
Text(getPriceString(item.needCount*item.price),
style: aTheme.style14W800,)
],
)
));
_found = true;
}
Widget _addons = Column(children: list,);
return Container(
padding: EdgeInsets.all(20),
color: (aTheme.darkMode) ? Colors.black : Colors.white,
child: Column(
children: [
Text(_get("pricing"), style: aTheme.style14W800),
Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black),
SizedBox(height: 5,),
Row(
children: [
Expanded(child: Text(getTextByLocale(price.name, _get("locale")), style: aTheme.style12W400)),
Text(getPriceString(price.getPrice()), style: aTheme.style14W800,)
],
),
SizedBox(height: 5,),
// Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black),
SizedBox(height: 5,),
Row(
children: [
Expanded(child: Text(_get("quantity"), style: aTheme.style12W400,)),
Text(productData.countProduct.toString(), style: aTheme.style14W800,)
],
),
if (_found)
_addons,
SizedBox(height: 5,),
Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black),
SizedBox(height: 5,),
Row(
children: [
Expanded(child: Text(_get("subtotal"), style: aTheme.style12W400)),
Text(getPriceString(getSubTotalWithoutCoupon()), style: aTheme.style14W800,)
],
),
SizedBox(height: 10,),
Row(
children: [
Expanded(child: Text(_get("discount"), style: aTheme.style12W400)),
Text("(-${getCouponStringData()}) ${getPriceString(getCoupon())}", style: aTheme.style14W800,)
],
),
if (getCoupon() != 0)
SizedBox(height: 5,),
if (getCoupon() != 0)
Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black),
if (getCoupon() != 0)
SizedBox(height: 5,),
if (getCoupon() != 0)
Row(
children: [
Expanded(child: Text(_get("subtotal"), style: aTheme.style12W400)),
Text(getPriceString(getSubTotalWithCoupon()), style: aTheme.style14W800,)
],
),
SizedBox(height: 10,),
Row(
children: [
Expanded(child: Text(_get("taxAmount"), style: aTheme.style12W400)),
Text("(+${productData.tax}%) ${getPriceString(getTax())}", style: aTheme.style14W800,)
],
),
SizedBox(height: 5,),
Divider(color: (aTheme.darkMode) ? Colors.white : Colors.black),
SizedBox(height: 5,),
Row(
children: [
Expanded(child: Text(_get("total"), style: aTheme.style12W400)),
Text(getPriceString(getTotal()), style: aTheme.style16W800Orange,)
],
),
],
)
);
}