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;
|
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 {
|
||||||
|
|||||||
@ -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(
|
||||||
|
context,
|
||||||
refreshController: _refreshController,
|
refreshController: _refreshController,
|
||||||
onRefresh: _onRefresh,
|
onRefresh: _onRefresh,
|
||||||
onLoading: _onLoading,
|
onLoading: _onLoading,
|
||||||
products: _products,
|
products: _products,
|
||||||
onTap: _showProduct,),
|
onTap: _showProduct,
|
||||||
|
),
|
||||||
flex: 1,
|
flex: 1,
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -302,8 +302,7 @@ 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,
|
||||||
@ -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),
|
||||||
|
|||||||
@ -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(
|
||||||
@ -217,10 +217,15 @@ Widget wsCardProductItem(BuildContext context,
|
|||||||
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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -256,19 +261,34 @@ Widget wsCardProductItem(BuildContext context,
|
|||||||
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
|
||||||
|
.copyWith(
|
||||||
|
color: Colors.black54, fontSize: 11),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: formatStringCurrency(
|
||||||
|
total: product.regularPrice),
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyText1
|
||||||
|
.copyWith(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
fontSize: 11
|
fontSize: 11),
|
||||||
),),
|
),
|
||||||
TextSpan(text: " | ${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}", style: Theme.of(context).textTheme.bodyText1.copyWith(
|
TextSpan(
|
||||||
color: Colors.black87,
|
text:
|
||||||
fontSize: 11
|
" | ${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