v2.0.6 last tweaks

This commit is contained in:
WooSignal 2020-05-17 15:18:59 +01:00
parent 0681097f9b
commit a81c115e8d
5 changed files with 75 additions and 49 deletions

View File

@ -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 {
@ -505,7 +507,7 @@ Widget refreshableScroll(context,
child: (products.length != null && products.length > 0
? GridView.count(
crossAxisCount: 2,
childAspectRatio: calAspectRatio(context),
childAspectRatio: calAspectRatio(context),
shrinkWrap: true,
children: List.generate(
products.length,

View File

@ -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,
refreshController: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
products: _products,
onTap: _showProduct,),
child: refreshableScroll(
context,
refreshController: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
products: _products,
onTap: _showProduct,
),
flex: 1,
)),
],

View File

@ -302,13 +302,12 @@ class _ProductDetailState extends State<ProductDetailPage> {
itemBuilder: (BuildContext context, int index) {
return CachedNetworkImage(
imageUrl: _product.images[index].src,
placeholder: (context, url) =>
Center(
child: new CircularProgressIndicator(
strokeWidth: 2,
backgroundColor: Colors.black12,
placeholder: (context, url) => Center(
child: new CircularProgressIndicator(
strokeWidth: 2,
backgroundColor: Colors.black12,
),
),
),
errorWidget: (context, url, error) =>
new Icon(Icons.error),
fit: BoxFit.contain,
@ -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),

View File

@ -206,7 +206,7 @@ List<BoxShadow> wsBoxShadow({double blurRadius}) {
Widget wsCardProductItem(BuildContext context,
{int index, Product product, onTap}) {
return LayoutBuilder(
builder: (cxt,constraints) => InkWell(
builder: (cxt, constraints) => InkWell(
child: Container(
margin: EdgeInsets.all(4),
child: Column(
@ -216,11 +216,16 @@ Widget wsCardProductItem(BuildContext context,
borderRadius: BorderRadius.circular(3.0),
child: CachedNetworkImage(
imageUrl:
(product.images.length > 0 ? product.images.first.src : ""),
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
(product.images.length > 0 ? product.images.first.src : ""),
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,
),
),
@ -251,27 +256,42 @@ Widget wsCardProductItem(BuildContext context,
child: Container(
child: (product.onSale && product.type != "variable"
? RichText(
textAlign: TextAlign.left,
text: TextSpan(
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(
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
),),
],
),
)
textAlign: TextAlign.left,
text: TextSpan(
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(
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),
),
],
),
)
: null),
width: double.infinity,
),

View File

@ -3,7 +3,7 @@
</p>
# WooCommerce App: Label StoreMax
### Label StoreMax - v2.0.5
### Label StoreMax - v2.0.6
[Official WooSignal WooCommerce App](https://woosignal.com)