v2.0.6 last tweaks
This commit is contained in:
parent
0681097f9b
commit
a81c115e8d
@ -151,10 +151,12 @@ String formatStringCurrency({@required String total}) {
|
||||
return fmf.output.symbolOnLeft;
|
||||
}
|
||||
|
||||
String workoutSaleDiscount({@required String salePrice, @required String priceBefore}) {
|
||||
String workoutSaleDiscount(
|
||||
{@required String salePrice, @required String priceBefore}) {
|
||||
double dSalePrice = parseWcPrice(salePrice);
|
||||
double dPriceBefore = parseWcPrice(priceBefore);
|
||||
return ((dPriceBefore-dSalePrice) * (100 / dPriceBefore)).toStringAsFixed(0);
|
||||
return ((dPriceBefore - dSalePrice) * (100 / dPriceBefore))
|
||||
.toStringAsFixed(0);
|
||||
}
|
||||
|
||||
openBrowserTab({@required String url}) async {
|
||||
|
||||
@ -145,8 +145,10 @@ class _HomePageState extends State<HomePage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(trans(context, "Shop") + " / ",
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,),
|
||||
Text(
|
||||
trans(context, "Shop") + " / ",
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
),
|
||||
Text(
|
||||
trans(context, "Newest"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
@ -167,12 +169,14 @@ class _HomePageState extends State<HomePage> {
|
||||
(_isLoading
|
||||
? Expanded(child: showAppLoader())
|
||||
: Expanded(
|
||||
child: refreshableScroll(context,
|
||||
child: refreshableScroll(
|
||||
context,
|
||||
refreshController: _refreshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
products: _products,
|
||||
onTap: _showProduct,),
|
||||
onTap: _showProduct,
|
||||
),
|
||||
flex: 1,
|
||||
)),
|
||||
],
|
||||
|
||||
@ -302,8 +302,7 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: _product.images[index].src,
|
||||
placeholder: (context, url) =>
|
||||
Center(
|
||||
placeholder: (context, url) => Center(
|
||||
child: new CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
backgroundColor: Colors.black12,
|
||||
@ -361,7 +360,8 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
||||
),
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
(_product.onSale == true && _product.type != "variable"
|
||||
(_product.onSale == true &&
|
||||
_product.type != "variable"
|
||||
? Text(
|
||||
formatStringCurrency(
|
||||
total: _product.regularPrice),
|
||||
|
||||
@ -217,10 +217,15 @@ Widget wsCardProductItem(BuildContext context,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:
|
||||
(product.images.length > 0 ? product.images.first.src : ""),
|
||||
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
|
||||
placeholder: (context, url) => Container(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
height: constraints.maxHeight / 1.75,
|
||||
),
|
||||
errorWidget: (context, url, error) => new Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
height: constraints.maxHeight / 1.8,
|
||||
fit: BoxFit.fitWidth,
|
||||
height: constraints.maxHeight / 1.75,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
@ -239,10 +244,10 @@ Widget wsCardProductItem(BuildContext context,
|
||||
padding: const EdgeInsets.only(top: 1),
|
||||
child: Text(
|
||||
formatStringCurrency(total: product.price),
|
||||
style: Theme.of(context).textTheme.bodyText1.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16
|
||||
),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.copyWith(fontWeight: FontWeight.w600, fontSize: 16),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
@ -256,19 +261,34 @@ Widget wsCardProductItem(BuildContext context,
|
||||
text: '',
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
children: <TextSpan>[
|
||||
TextSpan(text: '${trans(context, "Was")}: ', style: Theme.of(context).textTheme.bodyText1.copyWith(
|
||||
color: Colors.black54,
|
||||
fontSize: 11
|
||||
),),
|
||||
TextSpan(text: formatStringCurrency(total: product.regularPrice), style: Theme.of(context).textTheme.bodyText1.copyWith(
|
||||
TextSpan(
|
||||
text: '${trans(context, "Was")}: ',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.copyWith(
|
||||
color: Colors.black54, fontSize: 11),
|
||||
),
|
||||
TextSpan(
|
||||
text: formatStringCurrency(
|
||||
total: product.regularPrice),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.copyWith(
|
||||
decoration: TextDecoration.lineThrough,
|
||||
color: Colors.grey,
|
||||
fontSize: 11
|
||||
),),
|
||||
TextSpan(text: " | ${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}", style: Theme.of(context).textTheme.bodyText1.copyWith(
|
||||
color: Colors.black87,
|
||||
fontSize: 11
|
||||
),),
|
||||
fontSize: 11),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
" | ${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.copyWith(
|
||||
color: Colors.black87, fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user