New product view, Improved product sale appearance, Bug fixes

This commit is contained in:
WooSignal 2020-05-17 14:11:15 +01:00
parent fc2041d450
commit 0681097f9b
9 changed files with 113 additions and 74 deletions

View File

@ -1,3 +1,9 @@
## [2.0.6] - 2020-05-17
* New product view
* Improved product sale appearance
* Bug fixes
## [2.0.5] - 2020-05-16
* RazorPay checkout added

View File

@ -45,4 +45,4 @@
</intent-filter>
</activity>
</application>
</manifest>
</manifest>

View File

@ -150,5 +150,7 @@
"Ship to a different address?": "Ship to a different address?",
"USE DETAILS": "USE DETAILS",
"Not supported, try a card payment": "Not supported, try a card payment",
"Invalid shipping address, please check your shipping details": "Invalid shipping address, please check your shipping details"
"Invalid shipping address, please check your shipping details": "Invalid shipping address, please check your shipping details",
"Was": "Was",
"off": "off"
}

View File

@ -151,6 +151,12 @@ String formatStringCurrency({@required String total}) {
return fmf.output.symbolOnLeft;
}
String workoutSaleDiscount({@required String salePrice, @required String priceBefore}) {
double dSalePrice = parseWcPrice(salePrice);
double dPriceBefore = parseWcPrice(priceBefore);
return ((dPriceBefore-dSalePrice) * (100 / dPriceBefore)).toStringAsFixed(0);
}
openBrowserTab({@required String url}) async {
await FlutterWebBrowser.openWebPage(
url: url, androidToolbarColor: Colors.white70);
@ -499,17 +505,30 @@ Widget refreshableScroll(context,
child: (products.length != null && products.length > 0
? GridView.count(
crossAxisCount: 2,
childAspectRatio: calAspectRatio(context),
shrinkWrap: true,
children: List.generate(
products.length,
(index) {
return wsCardProductItem(context,
index: index, product: products[index], onTap: onTap);
},
(index) => wsCardProductItem(context,
index: index, product: products[index], onTap: onTap),
))
: wsNoResults(context)),
);
}
double calAspectRatio(BuildContext context) {
if (MediaQuery.of(context).size.height > 800) {
return MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.85);
}
if (MediaQuery.of(context).size.height > 700) {
return MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.5);
}
return MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.3);
}
class UserAuth {
UserAuth._privateConstructor();
static final UserAuth instance = UserAuth._privateConstructor();

View File

@ -16,7 +16,7 @@ import 'dart:ui';
Developer Notes
SUPPORT EMAIL - support@woosignal.com
VERSION - 2.0.5
VERSION - 2.0.6
https://woosignal.com
*/

View File

@ -58,9 +58,7 @@ class _HomePageState extends State<HomePage> {
}
_fetchCategories() async {
_categories = await appWooSignal((api) {
return api.getProductCategories();
});
_categories = await appWooSignal((api) => api.getProductCategories());
}
_fetchMoreProducts() async {
@ -90,9 +88,7 @@ class _HomePageState extends State<HomePage> {
title: trans(context, "Categories"),
bodyWidget: ListView.separated(
itemCount: _categories.length,
separatorBuilder: (cxt, i) {
return Divider();
},
separatorBuilder: (cxt, i) => Divider(),
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text(parseHtmlString(_categories[index].name)),
@ -133,7 +129,7 @@ class _HomePageState extends State<HomePage> {
onPressed: () => Navigator.pushNamed(context, "/home-search")
.then((value) => _key.currentState.setState(() {})),
),
wsCartIcon(context, key: _key)
wsCartIcon(context, key: _key),
],
),
body: SafeArea(
@ -150,7 +146,7 @@ class _HomePageState extends State<HomePage> {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(trans(context, "Shop") + " / ",
style: Theme.of(context).primaryTextTheme.subtitle1),
style: Theme.of(context).primaryTextTheme.subtitle1,),
Text(
trans(context, "Newest"),
style: Theme.of(context).primaryTextTheme.bodyText2,
@ -176,7 +172,7 @@ class _HomePageState extends State<HomePage> {
onRefresh: _onRefresh,
onLoading: _onLoading,
products: _products,
onTap: _showProduct),
onTap: _showProduct,),
flex: 1,
)),
],

View File

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

View File

@ -205,68 +205,82 @@ List<BoxShadow> wsBoxShadow({double blurRadius}) {
Widget wsCardProductItem(BuildContext context,
{int index, Product product, onTap}) {
return InkWell(
child: Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
boxShadow: wsBoxShadow(blurRadius: 4),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Flexible(
child: CachedNetworkImage(
imageUrl:
(product.images.length > 0 ? product.images.first.src : ""),
placeholder: (context, url) => new CircularProgressIndicator(),
errorWidget: (context, url, error) => new Icon(Icons.error),
fit: BoxFit.contain,
return LayoutBuilder(
builder: (cxt,constraints) => InkWell(
child: Container(
margin: EdgeInsets.all(4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(3.0),
child: CachedNetworkImage(
imageUrl:
(product.images.length > 0 ? product.images.first.src : ""),
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => new Icon(Icons.error),
fit: BoxFit.cover,
height: constraints.maxHeight / 1.8,
width: double.infinity,
),
),
flex: 4,
),
Flexible(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
Padding(
padding: const EdgeInsets.only(top: 1),
child: Text(
product.name,
style: Theme.of(context).textTheme.bodyText2,
overflow: TextOverflow.ellipsis,
maxLines: 2,
textAlign: TextAlign.left,
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(top: 1),
child: Text(
formatStringCurrency(total: product.price),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText1.copyWith(
fontWeight: FontWeight.w600,
fontSize: 16
),
textAlign: TextAlign.left,
),
(product.onSale
? Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(
formatStringCurrency(total: product.regularPrice),
style: Theme.of(context).textTheme.bodyText1.copyWith(
decoration: TextDecoration.lineThrough,
color: Colors.grey,
),
textAlign: TextAlign.left,
),
)
),
),
Flexible(
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
),),
],
),
)
: null),
].where((t) => t != null).toList(),
width: double.infinity,
),
),
flex: 1,
),
Expanded(
child: Text(
product.name,
style: Theme.of(context).textTheme.bodyText2,
overflow: TextOverflow.clip,
maxLines: 1,
),
flex: 1,
)
],
].where((e) => e != null).toList(),
),
),
onTap: () => onTap(product),
),
onTap: () => onTap(product),
);
}

View File

@ -1,5 +1,5 @@
# Label StoreMax
# Version 2.0.5
# Version 2.0.6
#authors: - "Anthony Gordon"
#documentation: https://woosignal.com/docs/app/ios/label-storemax
#homepage: https://woosignal.com/