Skip to content

Commit 0681097

Browse files
author
WooSignal
committed
New product view, Improved product sale appearance, Bug fixes
1 parent fc2041d commit 0681097

File tree

9 files changed

+113
-74
lines changed

9 files changed

+113
-74
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [2.0.6] - 2020-05-17
2+
3+
* New product view
4+
* Improved product sale appearance
5+
* Bug fixes
6+
17
## [2.0.5] - 2020-05-16
28

39
* RazorPay checkout added

LabelStoreMax/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
</intent-filter>
4646
</activity>
4747
</application>
48-
</manifest>
48+
</manifest>

LabelStoreMax/lang/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,7 @@
150150
"Ship to a different address?": "Ship to a different address?",
151151
"USE DETAILS": "USE DETAILS",
152152
"Not supported, try a card payment": "Not supported, try a card payment",
153-
"Invalid shipping address, please check your shipping details": "Invalid shipping address, please check your shipping details"
153+
"Invalid shipping address, please check your shipping details": "Invalid shipping address, please check your shipping details",
154+
"Was": "Was",
155+
"off": "off"
154156
}

LabelStoreMax/lib/helpers/tools.dart

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ String formatStringCurrency({@required String total}) {
151151
return fmf.output.symbolOnLeft;
152152
}
153153

154+
String workoutSaleDiscount({@required String salePrice, @required String priceBefore}) {
155+
double dSalePrice = parseWcPrice(salePrice);
156+
double dPriceBefore = parseWcPrice(priceBefore);
157+
return ((dPriceBefore-dSalePrice) * (100 / dPriceBefore)).toStringAsFixed(0);
158+
}
159+
154160
openBrowserTab({@required String url}) async {
155161
await FlutterWebBrowser.openWebPage(
156162
url: url, androidToolbarColor: Colors.white70);
@@ -499,17 +505,30 @@ Widget refreshableScroll(context,
499505
child: (products.length != null && products.length > 0
500506
? GridView.count(
501507
crossAxisCount: 2,
508+
childAspectRatio: calAspectRatio(context),
509+
shrinkWrap: true,
502510
children: List.generate(
503511
products.length,
504-
(index) {
505-
return wsCardProductItem(context,
506-
index: index, product: products[index], onTap: onTap);
507-
},
512+
(index) => wsCardProductItem(context,
513+
index: index, product: products[index], onTap: onTap),
508514
))
509515
: wsNoResults(context)),
510516
);
511517
}
512518

519+
double calAspectRatio(BuildContext context) {
520+
if (MediaQuery.of(context).size.height > 800) {
521+
return MediaQuery.of(context).size.width /
522+
(MediaQuery.of(context).size.height / 1.85);
523+
}
524+
if (MediaQuery.of(context).size.height > 700) {
525+
return MediaQuery.of(context).size.width /
526+
(MediaQuery.of(context).size.height / 1.5);
527+
}
528+
return MediaQuery.of(context).size.width /
529+
(MediaQuery.of(context).size.height / 1.3);
530+
}
531+
513532
class UserAuth {
514533
UserAuth._privateConstructor();
515534
static final UserAuth instance = UserAuth._privateConstructor();

LabelStoreMax/lib/labelconfig.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import 'dart:ui';
1616
Developer Notes
1717
1818
SUPPORT EMAIL - support@woosignal.com
19-
VERSION - 2.0.5
19+
VERSION - 2.0.6
2020
https://woosignal.com
2121
*/
2222

LabelStoreMax/lib/pages/home.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ class _HomePageState extends State<HomePage> {
5858
}
5959

6060
_fetchCategories() async {
61-
_categories = await appWooSignal((api) {
62-
return api.getProductCategories();
63-
});
61+
_categories = await appWooSignal((api) => api.getProductCategories());
6462
}
6563

6664
_fetchMoreProducts() async {
@@ -90,9 +88,7 @@ class _HomePageState extends State<HomePage> {
9088
title: trans(context, "Categories"),
9189
bodyWidget: ListView.separated(
9290
itemCount: _categories.length,
93-
separatorBuilder: (cxt, i) {
94-
return Divider();
95-
},
91+
separatorBuilder: (cxt, i) => Divider(),
9692
itemBuilder: (BuildContext context, int index) {
9793
return ListTile(
9894
title: Text(parseHtmlString(_categories[index].name)),
@@ -133,7 +129,7 @@ class _HomePageState extends State<HomePage> {
133129
onPressed: () => Navigator.pushNamed(context, "/home-search")
134130
.then((value) => _key.currentState.setState(() {})),
135131
),
136-
wsCartIcon(context, key: _key)
132+
wsCartIcon(context, key: _key),
137133
],
138134
),
139135
body: SafeArea(
@@ -150,7 +146,7 @@ class _HomePageState extends State<HomePage> {
150146
mainAxisAlignment: MainAxisAlignment.start,
151147
children: <Widget>[
152148
Text(trans(context, "Shop") + " / ",
153-
style: Theme.of(context).primaryTextTheme.subtitle1),
149+
style: Theme.of(context).primaryTextTheme.subtitle1,),
154150
Text(
155151
trans(context, "Newest"),
156152
style: Theme.of(context).primaryTextTheme.bodyText2,
@@ -176,7 +172,7 @@ class _HomePageState extends State<HomePage> {
176172
onRefresh: _onRefresh,
177173
onLoading: _onLoading,
178174
products: _products,
179-
onTap: _showProduct),
175+
onTap: _showProduct,),
180176
flex: 1,
181177
)),
182178
],

LabelStoreMax/lib/pages/product_detail.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,12 @@ class _ProductDetailState extends State<ProductDetailPage> {
303303
return CachedNetworkImage(
304304
imageUrl: _product.images[index].src,
305305
placeholder: (context, url) =>
306-
new CircularProgressIndicator(
306+
Center(
307+
child: new CircularProgressIndicator(
307308
strokeWidth: 2,
308309
backgroundColor: Colors.black12,
309310
),
311+
),
310312
errorWidget: (context, url, error) =>
311313
new Icon(Icons.error),
312314
fit: BoxFit.contain,
@@ -359,7 +361,7 @@ class _ProductDetailState extends State<ProductDetailPage> {
359361
),
360362
textAlign: TextAlign.right,
361363
),
362-
(_product.onSale == true
364+
(_product.onSale == true && _product.type != "variable"
363365
? Text(
364366
formatStringCurrency(
365367
total: _product.regularPrice),

LabelStoreMax/lib/widgets/woosignal_ui.dart

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -205,68 +205,82 @@ List<BoxShadow> wsBoxShadow({double blurRadius}) {
205205

206206
Widget wsCardProductItem(BuildContext context,
207207
{int index, Product product, onTap}) {
208-
return InkWell(
209-
child: Container(
210-
padding: EdgeInsets.all(10),
211-
margin: EdgeInsets.all(5),
212-
decoration: BoxDecoration(
213-
color: Colors.white,
214-
borderRadius: BorderRadius.circular(5),
215-
boxShadow: wsBoxShadow(blurRadius: 4),
216-
),
217-
child: Column(
218-
mainAxisAlignment: MainAxisAlignment.spaceAround,
219-
children: <Widget>[
220-
Flexible(
221-
child: CachedNetworkImage(
222-
imageUrl:
223-
(product.images.length > 0 ? product.images.first.src : ""),
224-
placeholder: (context, url) => new CircularProgressIndicator(),
225-
errorWidget: (context, url, error) => new Icon(Icons.error),
226-
fit: BoxFit.contain,
208+
return LayoutBuilder(
209+
builder: (cxt,constraints) => InkWell(
210+
child: Container(
211+
margin: EdgeInsets.all(4),
212+
child: Column(
213+
crossAxisAlignment: CrossAxisAlignment.start,
214+
children: <Widget>[
215+
ClipRRect(
216+
borderRadius: BorderRadius.circular(3.0),
217+
child: CachedNetworkImage(
218+
imageUrl:
219+
(product.images.length > 0 ? product.images.first.src : ""),
220+
placeholder: (context, url) => Center(child: CircularProgressIndicator()),
221+
errorWidget: (context, url, error) => new Icon(Icons.error),
222+
fit: BoxFit.cover,
223+
height: constraints.maxHeight / 1.8,
224+
width: double.infinity,
225+
),
227226
),
228-
flex: 4,
229-
),
230-
Flexible(
231-
child: Row(
232-
crossAxisAlignment: CrossAxisAlignment.center,
233-
mainAxisAlignment: MainAxisAlignment.center,
234-
children: <Widget>[
235-
Text(
227+
Padding(
228+
padding: const EdgeInsets.only(top: 1),
229+
child: Text(
230+
product.name,
231+
style: Theme.of(context).textTheme.bodyText2,
232+
overflow: TextOverflow.ellipsis,
233+
maxLines: 2,
234+
textAlign: TextAlign.left,
235+
),
236+
),
237+
Flexible(
238+
child: Padding(
239+
padding: const EdgeInsets.only(top: 1),
240+
child: Text(
236241
formatStringCurrency(total: product.price),
237-
style: Theme.of(context).textTheme.bodyText1,
238-
textAlign: TextAlign.center,
242+
style: Theme.of(context).textTheme.bodyText1.copyWith(
243+
fontWeight: FontWeight.w600,
244+
fontSize: 16
245+
),
246+
textAlign: TextAlign.left,
239247
),
240-
(product.onSale
241-
? Padding(
242-
padding: const EdgeInsets.only(left: 8),
243-
child: Text(
244-
formatStringCurrency(total: product.regularPrice),
245-
style: Theme.of(context).textTheme.bodyText1.copyWith(
246-
decoration: TextDecoration.lineThrough,
247-
color: Colors.grey,
248-
),
249-
textAlign: TextAlign.left,
250-
),
251-
)
252-
: null),
253-
].where((t) => t != null).toList(),
248+
),
254249
),
255-
flex: 1,
256-
),
257-
Expanded(
258-
child: Text(
259-
product.name,
260-
style: Theme.of(context).textTheme.bodyText2,
261-
overflow: TextOverflow.clip,
262-
maxLines: 1,
250+
Flexible(
251+
child: Container(
252+
child: (product.onSale && product.type != "variable"
253+
? RichText(
254+
textAlign: TextAlign.left,
255+
text: TextSpan(
256+
text: '',
257+
style: Theme.of(context).textTheme.bodyText1,
258+
children: <TextSpan>[
259+
TextSpan(text: '${trans(context, "Was")}: ', style: Theme.of(context).textTheme.bodyText1.copyWith(
260+
color: Colors.black54,
261+
fontSize: 11
262+
),),
263+
TextSpan(text: formatStringCurrency(total: product.regularPrice), style: Theme.of(context).textTheme.bodyText1.copyWith(
264+
decoration: TextDecoration.lineThrough,
265+
color: Colors.grey,
266+
fontSize: 11
267+
),),
268+
TextSpan(text: " | ${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}", style: Theme.of(context).textTheme.bodyText1.copyWith(
269+
color: Colors.black87,
270+
fontSize: 11
271+
),),
272+
],
273+
),
274+
)
275+
: null),
276+
width: double.infinity,
277+
),
263278
),
264-
flex: 1,
265-
)
266-
],
279+
].where((e) => e != null).toList(),
280+
),
267281
),
282+
onTap: () => onTap(product),
268283
),
269-
onTap: () => onTap(product),
270284
);
271285
}
272286

LabelStoreMax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Label StoreMax
2-
# Version 2.0.5
2+
# Version 2.0.6
33
#authors: - "Anthony Gordon"
44
#documentation: https://woosignal.com/docs/app/ios/label-storemax
55
#homepage: https://woosignal.com/

0 commit comments

Comments
 (0)