v2.1.0 update for RazorPay, FreeShipping minimum value, new grid
This commit is contained in:
parent
09050b342d
commit
4269c5b7e0
@ -1,3 +1,9 @@
|
||||
## [2.1.0] - 2020-07-22
|
||||
|
||||
* Pubspec.yaml update for RazorPay
|
||||
* FreeShipping minimum value feature
|
||||
* New grid collection layout
|
||||
|
||||
## [2.0.9] - 2020-06-19
|
||||
|
||||
* New UI for home products
|
||||
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "Diese E-Mail wird genommen, versuchen Sie es mit einer anderen",
|
||||
"The email field is empty": "Das E-Mail-Feld ist leer",
|
||||
"No more orders": "Keine Bestellungen mehr",
|
||||
"Account updated": "Konto aktualisiert"
|
||||
"Account updated": "Konto aktualisiert",
|
||||
"Spend a minimum of": "Geben Sie mindestens ein",
|
||||
"for": "zum"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "That email is taken, try another",
|
||||
"The email field is empty": "The email field is empty",
|
||||
"No more orders": "No more orders",
|
||||
"Account updated": "Account updated"
|
||||
"Account updated": "Account updated",
|
||||
"Spend a minimum of": "Spend a minimum of",
|
||||
"for": "for"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "Ese correo electrónico está tomado, prueba con otro",
|
||||
"The email field is empty": "El campo de correo electrónico está vacío.",
|
||||
"No more orders": "No mas pedidos",
|
||||
"Account updated": "Cuenta actualizada"
|
||||
"Account updated": "Cuenta actualizada",
|
||||
"Spend a minimum of": "Gasta un mínimo de",
|
||||
"for": "para"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "Cet e-mail est pris, essayez un autre",
|
||||
"The email field is empty": "Le champ e-mail est vide",
|
||||
"No more orders": "Plus de commandes",
|
||||
"Account updated": "Compte mis à jour"
|
||||
"Account updated": "Compte mis à jour",
|
||||
"Spend a minimum of": "Dépensez un minimum de",
|
||||
"for": "pour"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "vah eemel liya gaya hai, doosara prayaas karen",
|
||||
"The email field is empty": "eemel feeld khaalee hai",
|
||||
"No more orders": "aur koee aadesh nahin",
|
||||
"Account updated": "khaata apadet kiya gaya"
|
||||
"Account updated": "khaata apadet kiya gaya",
|
||||
"Spend a minimum of": "kam se kam kharch karen",
|
||||
"for": "ke liye"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "Quell'e-mail è stata presa, provane un'altra",
|
||||
"The email field is empty": "Il campo email è vuoto",
|
||||
"No more orders": "Niente più ordini",
|
||||
"Account updated": "Account aggiornato"
|
||||
"Account updated": "Account aggiornato",
|
||||
"Spend a minimum of": "Spendi un minimo di",
|
||||
"for": "per"
|
||||
}
|
||||
@ -169,5 +169,7 @@
|
||||
"That email is taken, try another": "Esse e-mail foi recebido, tente outro",
|
||||
"The email field is empty": "O campo de email está vazio",
|
||||
"No more orders": "Não há mais pedidos",
|
||||
"Account updated": "Conta atualizada"
|
||||
"Account updated": "Conta atualizada",
|
||||
"Spend a minimum of": "Gaste um mínimo de",
|
||||
"for": "para"
|
||||
}
|
||||
@ -11,6 +11,7 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:label_storemax/app_payment_methods.dart';
|
||||
import 'package:label_storemax/helpers/app_localizations.dart';
|
||||
@ -78,7 +79,12 @@ class EdgeAlertStyle {
|
||||
}
|
||||
|
||||
void showEdgeAlertWith(context,
|
||||
{title = "", desc = "", int gravity = 1, int style = 1, IconData icon}) {
|
||||
{title = "",
|
||||
desc = "",
|
||||
int gravity = 1,
|
||||
int style = 1,
|
||||
IconData icon,
|
||||
int duration}) {
|
||||
switch (style) {
|
||||
case 1: // SUCCESS
|
||||
EdgeAlert.show(context,
|
||||
@ -87,7 +93,7 @@ void showEdgeAlertWith(context,
|
||||
gravity: gravity,
|
||||
backgroundColor: Colors.green,
|
||||
icon: icon ?? Icons.check,
|
||||
duration: EdgeAlert.LENGTH_LONG);
|
||||
duration: duration ?? EdgeAlert.LENGTH_LONG);
|
||||
break;
|
||||
case 2: // WARNING
|
||||
EdgeAlert.show(context,
|
||||
@ -96,7 +102,7 @@ void showEdgeAlertWith(context,
|
||||
gravity: gravity,
|
||||
backgroundColor: Colors.orange,
|
||||
icon: icon ?? Icons.error_outline,
|
||||
duration: EdgeAlert.LENGTH_LONG);
|
||||
duration: duration ?? EdgeAlert.LENGTH_LONG);
|
||||
break;
|
||||
case 3: // INFO
|
||||
EdgeAlert.show(context,
|
||||
@ -105,7 +111,7 @@ void showEdgeAlertWith(context,
|
||||
gravity: gravity,
|
||||
backgroundColor: Colors.teal,
|
||||
icon: icon ?? Icons.info,
|
||||
duration: EdgeAlert.LENGTH_LONG);
|
||||
duration: duration ?? EdgeAlert.LENGTH_LONG);
|
||||
break;
|
||||
case 4: // DANGER
|
||||
EdgeAlert.show(context,
|
||||
@ -114,7 +120,7 @@ void showEdgeAlertWith(context,
|
||||
gravity: gravity,
|
||||
backgroundColor: Colors.redAccent,
|
||||
icon: icon ?? Icons.warning,
|
||||
duration: EdgeAlert.LENGTH_LONG);
|
||||
duration: duration ?? EdgeAlert.LENGTH_LONG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -509,14 +515,24 @@ Widget refreshableScroll(context,
|
||||
onRefresh: onRefresh,
|
||||
onLoading: onLoading,
|
||||
child: (products.length != null && products.length > 0
|
||||
? GridView.count(
|
||||
? StaggeredGridView.countBuilder(
|
||||
crossAxisCount: 2,
|
||||
shrinkWrap: true,
|
||||
children: List.generate(
|
||||
products.length,
|
||||
(index) => wsCardProductItem(context,
|
||||
index: index, product: products[index], onTap: onTap),
|
||||
))
|
||||
itemCount: products.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: 200,
|
||||
child: wsCardProductItem(
|
||||
context,
|
||||
index: (index),
|
||||
product: products[index],
|
||||
onTap: onTap,
|
||||
),
|
||||
);
|
||||
},
|
||||
staggeredTileBuilder: (int index) => new StaggeredTile.fit(1),
|
||||
mainAxisSpacing: 4.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
)
|
||||
: wsNoResults(context)),
|
||||
);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import 'dart:ui';
|
||||
Developer Notes
|
||||
|
||||
SUPPORT EMAIL - support@woosignal.com
|
||||
VERSION - 2.0.9
|
||||
VERSION - 2.1.0
|
||||
https://woosignal.com
|
||||
*/
|
||||
|
||||
|
||||
@ -15,12 +15,17 @@ import '../helpers/tools.dart';
|
||||
class ShippingType {
|
||||
String methodId;
|
||||
String cost;
|
||||
String minimumValue;
|
||||
dynamic object;
|
||||
|
||||
ShippingType({this.methodId, this.object, this.cost});
|
||||
ShippingType({this.methodId, this.object, this.cost, this.minimumValue});
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{'methodId': methodId, 'object': object, 'cost': cost};
|
||||
Map<String, dynamic> toJson() => {
|
||||
'methodId': methodId,
|
||||
'object': object,
|
||||
'cost': cost,
|
||||
'minimumValue': minimumValue
|
||||
};
|
||||
|
||||
String getTotal({bool withFormatting}) {
|
||||
if (this.methodId != null && this.object != null) {
|
||||
|
||||
@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/app_payment_methods.dart';
|
||||
import 'package:label_storemax/app_state_options.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/models/cart.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
import 'package:label_storemax/models/customer_address.dart';
|
||||
import 'package:label_storemax/widgets/app_loader.dart';
|
||||
@ -376,6 +377,29 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckoutSession.getInstance.shippingType.minimumValue != null) {
|
||||
String total = await Cart.getInstance.getTotal();
|
||||
if (total == null) {
|
||||
return;
|
||||
}
|
||||
double doubleTotal = double.parse(total);
|
||||
double doubleMinimumValue =
|
||||
double.parse(CheckoutSession.getInstance.shippingType.minimumValue);
|
||||
|
||||
if (doubleTotal < doubleMinimumValue) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Sorry"),
|
||||
desc: trans(context, "Spend a minimum of") +
|
||||
" " +
|
||||
formatDoubleCurrency(total: doubleMinimumValue) +
|
||||
" ${trans(context, "for")} " +
|
||||
CheckoutSession.getInstance.shippingType.getTitle(),
|
||||
style: EdgeAlertStyle.INFO,
|
||||
duration: 3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_isProcessingPayment == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,13 +119,15 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
.where((t) => t != null)
|
||||
.toList()
|
||||
.forEach((freeShipping) {
|
||||
if (isNumeric(freeShipping.cost)) {
|
||||
if (isNumeric(freeShipping.cost) ||
|
||||
freeShipping.cost == 'min_amount') {
|
||||
Map<String, dynamic> tmpShippingOption = {};
|
||||
tmpShippingOption = {
|
||||
"id": freeShipping.id,
|
||||
"method_id": "free_shipping",
|
||||
"title": freeShipping.title,
|
||||
"cost": freeShipping.cost,
|
||||
"cost": "0.00",
|
||||
"min_amount": freeShipping.minimumOrderAmount,
|
||||
"object": freeShipping
|
||||
};
|
||||
_wsShippingOptions.add(tmpShippingOption);
|
||||
@ -246,11 +248,11 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: 16, right: 16),
|
||||
title: Text(
|
||||
_wsShippingOptions[index]
|
||||
['title'],
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle1),
|
||||
_wsShippingOptions[index]['title'],
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle1,
|
||||
),
|
||||
selected: true,
|
||||
subtitle: FutureBuilder<String>(
|
||||
future: _getShippingPrice(index),
|
||||
@ -267,14 +269,52 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
case ConnectionState.done:
|
||||
if (snapshot.hasError)
|
||||
return Text('');
|
||||
return Text(
|
||||
trans(context, "Price") +
|
||||
": " +
|
||||
formatStringCurrency(
|
||||
total: snapshot
|
||||
.data));
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
text: '',
|
||||
style: DefaultTextStyle.of(
|
||||
context)
|
||||
.style,
|
||||
children: <TextSpan>[
|
||||
(_wsShippingOptions[index]
|
||||
["object"]
|
||||
is FreeShipping
|
||||
? TextSpan(
|
||||
text:
|
||||
"Free postage")
|
||||
: TextSpan(
|
||||
text: trans(
|
||||
context,
|
||||
"Price") +
|
||||
": " +
|
||||
formatStringCurrency(
|
||||
total: snapshot
|
||||
.data),
|
||||
)),
|
||||
_wsShippingOptions[index][
|
||||
"min_amount"] !=
|
||||
null
|
||||
? TextSpan(
|
||||
text: "\nSpend a minimum of " +
|
||||
formatStringCurrency(
|
||||
total: _wsShippingOptions[
|
||||
index]
|
||||
[
|
||||
"min_amount"]),
|
||||
style: Theme.of(
|
||||
context)
|
||||
.primaryTextTheme
|
||||
.bodyText2
|
||||
.copyWith(
|
||||
fontSize:
|
||||
14))
|
||||
: null,
|
||||
]
|
||||
.where((e) => e != null)
|
||||
.toList(),
|
||||
));
|
||||
}
|
||||
return null; // unreachable
|
||||
return null;
|
||||
},
|
||||
),
|
||||
trailing: (CheckoutSession.getInstance
|
||||
@ -288,23 +328,8 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
["object"]
|
||||
? Icon(Icons.check)
|
||||
: null),
|
||||
onTap: () async {
|
||||
ShippingType shippingType =
|
||||
ShippingType();
|
||||
shippingType.object =
|
||||
_wsShippingOptions[index]
|
||||
['object'];
|
||||
shippingType.methodId =
|
||||
_wsShippingOptions[index]
|
||||
['method_id'];
|
||||
shippingType.cost =
|
||||
await _getShippingPrice(index);
|
||||
|
||||
CheckoutSession.getInstance
|
||||
.shippingType = shippingType;
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
onTap: () =>
|
||||
_handleCheckoutTapped(index),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -339,4 +364,18 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_handleCheckoutTapped(int index) async {
|
||||
ShippingType shippingType = ShippingType();
|
||||
shippingType.object = _wsShippingOptions[index]['object'];
|
||||
shippingType.methodId = _wsShippingOptions[index]['method_id'];
|
||||
if (_wsShippingOptions[index]['min_amount'] != null) {
|
||||
shippingType.minimumValue = _wsShippingOptions[index]['min_amount'];
|
||||
}
|
||||
shippingType.cost = await _getShippingPrice(index);
|
||||
|
||||
CheckoutSession.getInstance.shippingType = shippingType;
|
||||
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,8 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
|
||||
_fetchCategories() async {
|
||||
_categories = await appWooSignal((api) => api.getProductCategories());
|
||||
_categories =
|
||||
await appWooSignal((api) => api.getProductCategories(page: 100));
|
||||
}
|
||||
|
||||
_fetchMoreProducts() async {
|
||||
@ -133,6 +134,7 @@ class _HomePageState extends State<HomePage> {
|
||||
wsCartIcon(context, key: _key),
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: Column(
|
||||
|
||||
@ -220,6 +220,11 @@ Widget wsCardProductItem(BuildContext context,
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.grey[100],
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
),
|
||||
CachedNetworkImage(
|
||||
imageUrl: (product.images.length > 0
|
||||
? product.images.first.src
|
||||
@ -237,11 +242,11 @@ Widget wsCardProductItem(BuildContext context,
|
||||
),
|
||||
(product.onSale && product.type != "variable"
|
||||
? Positioned(
|
||||
bottom: 5,
|
||||
left: 8,
|
||||
right: 8,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(2),
|
||||
padding: EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
@ -273,7 +278,7 @@ Widget wsCardProductItem(BuildContext context,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
margin: const EdgeInsets.only(top: 2, bottom: 2),
|
||||
child: Text(
|
||||
product.name,
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
|
||||
@ -127,6 +127,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -193,6 +200,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.2+1"
|
||||
flutter_staggered_grid_view:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_staggered_grid_view
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
flutter_swiper:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -293,7 +307,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.4"
|
||||
version: "1.7.0"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -385,20 +399,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.8"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
razorpay_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: razorpay_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "1.2.2"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -508,7 +515,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.15"
|
||||
version: "0.2.16"
|
||||
transformer_page_view:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -571,7 +578,7 @@ packages:
|
||||
name: woosignal
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.2"
|
||||
woosignal_stripe:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Label StoreMax
|
||||
# Version 2.0.9
|
||||
# Version 2.1.0
|
||||
#authors: - "Anthony Gordon"
|
||||
#documentation: https://woosignal.com/docs/app/ios/label-storemax
|
||||
#homepage: https://woosignal.com/
|
||||
@ -24,9 +24,9 @@ environment:
|
||||
sdk: ">=2.1.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
woosignal: ^1.1.0
|
||||
woosignal: ^1.1.2
|
||||
woosignal_stripe: ^0.0.6
|
||||
razorpay_flutter: ^1.2.1
|
||||
razorpay_flutter: ^1.2.2
|
||||
wp_json_api: ^0.1.4
|
||||
shared_preferences: ^0.5.7+3
|
||||
cached_network_image: ^2.2.0+1
|
||||
@ -47,6 +47,7 @@ dependencies:
|
||||
flutter_launcher_icons: ^0.7.5
|
||||
auto_size_text: ^2.1.0
|
||||
html: ^0.14.0+3
|
||||
flutter_staggered_grid_view: ^0.3.1
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user