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; 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 dSalePrice = parseWcPrice(salePrice);
double dPriceBefore = parseWcPrice(priceBefore); double dPriceBefore = parseWcPrice(priceBefore);
return ((dPriceBefore-dSalePrice) * (100 / dPriceBefore)).toStringAsFixed(0); return ((dPriceBefore - dSalePrice) * (100 / dPriceBefore))
.toStringAsFixed(0);
} }
openBrowserTab({@required String url}) async { openBrowserTab({@required String url}) async {
@ -505,7 +507,7 @@ Widget refreshableScroll(context,
child: (products.length != null && products.length > 0 child: (products.length != null && products.length > 0
? GridView.count( ? GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: calAspectRatio(context), childAspectRatio: calAspectRatio(context),
shrinkWrap: true, shrinkWrap: true,
children: List.generate( children: List.generate(
products.length, products.length,

View File

@ -145,8 +145,10 @@ class _HomePageState extends State<HomePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text(trans(context, "Shop") + " / ", Text(
style: Theme.of(context).primaryTextTheme.subtitle1,), trans(context, "Shop") + " / ",
style: Theme.of(context).primaryTextTheme.subtitle1,
),
Text( Text(
trans(context, "Newest"), trans(context, "Newest"),
style: Theme.of(context).primaryTextTheme.bodyText2, style: Theme.of(context).primaryTextTheme.bodyText2,
@ -167,12 +169,14 @@ class _HomePageState extends State<HomePage> {
(_isLoading (_isLoading
? Expanded(child: showAppLoader()) ? Expanded(child: showAppLoader())
: Expanded( : Expanded(
child: refreshableScroll(context, child: refreshableScroll(
refreshController: _refreshController, context,
onRefresh: _onRefresh, refreshController: _refreshController,
onLoading: _onLoading, onRefresh: _onRefresh,
products: _products, onLoading: _onLoading,
onTap: _showProduct,), products: _products,
onTap: _showProduct,
),
flex: 1, flex: 1,
)), )),
], ],

View File

@ -302,13 +302,12 @@ class _ProductDetailState extends State<ProductDetailPage> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return CachedNetworkImage( return CachedNetworkImage(
imageUrl: _product.images[index].src, imageUrl: _product.images[index].src,
placeholder: (context, url) => placeholder: (context, url) => Center(
Center( child: new CircularProgressIndicator(
child: new CircularProgressIndicator( strokeWidth: 2,
strokeWidth: 2, backgroundColor: Colors.black12,
backgroundColor: Colors.black12, ),
), ),
),
errorWidget: (context, url, error) => errorWidget: (context, url, error) =>
new Icon(Icons.error), new Icon(Icons.error),
fit: BoxFit.contain, fit: BoxFit.contain,
@ -361,7 +360,8 @@ class _ProductDetailState extends State<ProductDetailPage> {
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
), ),
(_product.onSale == true && _product.type != "variable" (_product.onSale == true &&
_product.type != "variable"
? Text( ? Text(
formatStringCurrency( formatStringCurrency(
total: _product.regularPrice), total: _product.regularPrice),

View File

@ -206,7 +206,7 @@ List<BoxShadow> wsBoxShadow({double blurRadius}) {
Widget wsCardProductItem(BuildContext context, Widget wsCardProductItem(BuildContext context,
{int index, Product product, onTap}) { {int index, Product product, onTap}) {
return LayoutBuilder( return LayoutBuilder(
builder: (cxt,constraints) => InkWell( builder: (cxt, constraints) => InkWell(
child: Container( child: Container(
margin: EdgeInsets.all(4), margin: EdgeInsets.all(4),
child: Column( child: Column(
@ -216,11 +216,16 @@ Widget wsCardProductItem(BuildContext context,
borderRadius: BorderRadius.circular(3.0), borderRadius: BorderRadius.circular(3.0),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: imageUrl:
(product.images.length > 0 ? product.images.first.src : ""), (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), errorWidget: (context, url, error) => new Icon(Icons.error),
fit: BoxFit.cover, fit: BoxFit.fitWidth,
height: constraints.maxHeight / 1.8, height: constraints.maxHeight / 1.75,
width: double.infinity, width: double.infinity,
), ),
), ),
@ -239,10 +244,10 @@ Widget wsCardProductItem(BuildContext context,
padding: const EdgeInsets.only(top: 1), padding: const EdgeInsets.only(top: 1),
child: Text( child: Text(
formatStringCurrency(total: product.price), formatStringCurrency(total: product.price),
style: Theme.of(context).textTheme.bodyText1.copyWith( style: Theme.of(context)
fontWeight: FontWeight.w600, .textTheme
fontSize: 16 .bodyText1
), .copyWith(fontWeight: FontWeight.w600, fontSize: 16),
textAlign: TextAlign.left, textAlign: TextAlign.left,
), ),
), ),
@ -251,27 +256,42 @@ Widget wsCardProductItem(BuildContext context,
child: Container( child: Container(
child: (product.onSale && product.type != "variable" child: (product.onSale && product.type != "variable"
? RichText( ? RichText(
textAlign: TextAlign.left, textAlign: TextAlign.left,
text: TextSpan( text: TextSpan(
text: '', text: '',
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyText1,
children: <TextSpan>[ children: <TextSpan>[
TextSpan(text: '${trans(context, "Was")}: ', style: Theme.of(context).textTheme.bodyText1.copyWith( TextSpan(
color: Colors.black54, text: '${trans(context, "Was")}: ',
fontSize: 11 style: Theme.of(context)
),), .textTheme
TextSpan(text: formatStringCurrency(total: product.regularPrice), style: Theme.of(context).textTheme.bodyText1.copyWith( .bodyText1
decoration: TextDecoration.lineThrough, .copyWith(
color: Colors.grey, color: Colors.black54, fontSize: 11),
fontSize: 11 ),
),), TextSpan(
TextSpan(text: " | ${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}", style: Theme.of(context).textTheme.bodyText1.copyWith( text: formatStringCurrency(
color: Colors.black87, total: product.regularPrice),
fontSize: 11 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), : null),
width: double.infinity, width: double.infinity,
), ),

View File

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