purchase success info
This commit is contained in:
21
.editorconfig
Normal file
21
.editorconfig
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
|
||||||
|
[*]
|
||||||
|
|
||||||
|
# Change these settings to your own preference
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# We recommend you to keep these unchanged
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
@@ -36,6 +36,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Activation request for the application has been sent, please wait for administrator approval"),
|
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Activation request for the application has been sent, please wait for administrator approval"),
|
||||||
"reward" : MessageLookupByLibrary.simpleMessage("Reward"),
|
"reward" : MessageLookupByLibrary.simpleMessage("Reward"),
|
||||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bonus on account"),
|
"bonus" : MessageLookupByLibrary.simpleMessage("Bonus on account"),
|
||||||
|
"discount_rate" : MessageLookupByLibrary.simpleMessage("Dicount Rate"),
|
||||||
|
"discount_sum" : MessageLookupByLibrary.simpleMessage("Dicount Sum"),
|
||||||
|
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Bonus points"),
|
||||||
|
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Bonus was charged"),
|
||||||
"scan" : MessageLookupByLibrary.simpleMessage("Scan"),
|
"scan" : MessageLookupByLibrary.simpleMessage("Scan"),
|
||||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Sign Up"),
|
"sign_up" : MessageLookupByLibrary.simpleMessage("Sign Up"),
|
||||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Specify the store ID"),
|
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Specify the store ID"),
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("El requieremento de activación de aplicación esta mandado, esperad la activación por el administrador."),
|
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("El requieremento de activación de aplicación esta mandado, esperad la activación por el administrador."),
|
||||||
"reward" : MessageLookupByLibrary.simpleMessage("Gratificación"),
|
"reward" : MessageLookupByLibrary.simpleMessage("Gratificación"),
|
||||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bono por cuenta"),
|
"bonus" : MessageLookupByLibrary.simpleMessage("Bono por cuenta"),
|
||||||
|
"discount_rate" : MessageLookupByLibrary.simpleMessage("Tasa de descuento"),
|
||||||
|
"discount_sum" : MessageLookupByLibrary.simpleMessage("El monto del descuento"),
|
||||||
|
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Puntos de bonificación"),
|
||||||
|
"bonus_minus" : MessageLookupByLibrary.simpleMessage("El bono fue cobrado"),
|
||||||
"scan" : MessageLookupByLibrary.simpleMessage("Escanear"),
|
"scan" : MessageLookupByLibrary.simpleMessage("Escanear"),
|
||||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Registrarse"),
|
"sign_up" : MessageLookupByLibrary.simpleMessage("Registrarse"),
|
||||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Hay que dar DIN del negocio"),
|
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Hay que dar DIN del negocio"),
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запрос на активацию приложения отправлен, дождитесь подтверждения активации администратором"),
|
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запрос на активацию приложения отправлен, дождитесь подтверждения активации администратором"),
|
||||||
"reward" : MessageLookupByLibrary.simpleMessage("Вознаграждение"),
|
"reward" : MessageLookupByLibrary.simpleMessage("Вознаграждение"),
|
||||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусов на счету"),
|
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусов на счету"),
|
||||||
|
"discount_rate" : MessageLookupByLibrary.simpleMessage("Процент скидки"),
|
||||||
|
"discount_sum" : MessageLookupByLibrary.simpleMessage("Сумма скидки"),
|
||||||
|
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Бонусов начислено"),
|
||||||
|
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Бонусов списано"),
|
||||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканировать"),
|
"scan" : MessageLookupByLibrary.simpleMessage("Сканировать"),
|
||||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зарегистрироваться"),
|
"sign_up" : MessageLookupByLibrary.simpleMessage("Зарегистрироваться"),
|
||||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необходимо указать ID магазина"),
|
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необходимо указать ID магазина"),
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запит на активацію додатку відправлений, дочекайтеся підтвердження активації адміністратором"),
|
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запит на активацію додатку відправлений, дочекайтеся підтвердження активації адміністратором"),
|
||||||
"reward" : MessageLookupByLibrary.simpleMessage("Винагорода"),
|
"reward" : MessageLookupByLibrary.simpleMessage("Винагорода"),
|
||||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусів на рахунку"),
|
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусів на рахунку"),
|
||||||
|
"discount_rate" : MessageLookupByLibrary.simpleMessage("Відсоток знижки"),
|
||||||
|
"discount_sum" : MessageLookupByLibrary.simpleMessage("Сума знижки"),
|
||||||
|
"bonus_plus" : MessageLookupByLibrary.simpleMessage("Бонусів нараховано"),
|
||||||
|
"bonus_minus" : MessageLookupByLibrary.simpleMessage("Бонусів списано"),
|
||||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканувати"),
|
"scan" : MessageLookupByLibrary.simpleMessage("Сканувати"),
|
||||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зареєструватися"),
|
"sign_up" : MessageLookupByLibrary.simpleMessage("Зареєструватися"),
|
||||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необхідно вказати ID магазину"),
|
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необхідно вказати ID магазину"),
|
||||||
|
|||||||
@@ -247,7 +247,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
sumTotal,
|
sumTotal,
|
||||||
user['first_name'] == null ? '' : user['first_name'],
|
user['first_name'] == null ? '' : user['first_name'],
|
||||||
helper,
|
helper,
|
||||||
app));
|
app,
|
||||||
|
parsedMap
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
purchaseInProgress = false;
|
purchaseInProgress = false;
|
||||||
|
|||||||
@@ -8,28 +8,45 @@ import 'package:flutter/material.dart';
|
|||||||
/// Экран проведения покупки.
|
/// Экран проведения покупки.
|
||||||
class PurchaseSuccessScreen extends StatefulWidget {
|
class PurchaseSuccessScreen extends StatefulWidget {
|
||||||
|
|
||||||
PurchaseSuccessScreen(this.val, this.name, this.helper, this.app);
|
PurchaseSuccessScreen(this.val, this.name, this.helper, this.app, this.details);
|
||||||
|
|
||||||
final String val;
|
final String val;
|
||||||
final String name;
|
final String name;
|
||||||
final String app;
|
final String app;
|
||||||
final SqliteHelper helper;
|
final SqliteHelper helper;
|
||||||
|
final Map details;
|
||||||
|
|
||||||
@override State createState() =>
|
@override State createState() =>
|
||||||
new PurchaseSuccessScreenState(val, name, helper, app);
|
new PurchaseSuccessScreenState(val, name, helper, app, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||||
|
|
||||||
PurchaseSuccessScreenState(String sum, String username, SqliteHelper helper,
|
PurchaseSuccessScreenState(
|
||||||
String app) {
|
String sum, String username, SqliteHelper helper,
|
||||||
|
String app, Map details
|
||||||
|
){
|
||||||
this.sum = sum;
|
this.sum = sum;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.helper = helper;
|
this.helper = helper;
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
this.details = details;
|
||||||
|
|
||||||
|
String regexString = r'(\d+) начислено, (\d+).*';
|
||||||
|
RegExp regExp = new RegExp(regexString);
|
||||||
|
var matches = regExp.allMatches(this.details['sum_bonus']);
|
||||||
|
if(matches.length != 0) {
|
||||||
|
var match = matches.elementAt(0); // => extract the first (and only) match
|
||||||
|
bonusPlus = int.parse(match.group(1));
|
||||||
|
bonusMinus = int.parse(match.group(2));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String sum, username;
|
String sum, username;
|
||||||
|
Map details;
|
||||||
|
int bonusPlus = 0;
|
||||||
|
int bonusMinus = 0;
|
||||||
int currency;
|
int currency;
|
||||||
|
|
||||||
@override String getTitle() {
|
@override String getTitle() {
|
||||||
@@ -52,12 +69,27 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override Widget getScreenContent() {
|
@override Widget getScreenContent() {
|
||||||
return new Column(children: <Widget>[
|
|
||||||
getValueWithDescription(StringsLocalization.buyer(), username),
|
|
||||||
getSuccessMessage(),
|
|
||||||
new Expanded(child: new Center()),
|
List <Widget> widgetList = <Widget>[];
|
||||||
wrapButton(getScreenMargins(74.0), getScanButton())
|
widgetList.add(getValueWithDescription(StringsLocalization.buyer(), username));
|
||||||
]);
|
widgetList.add(getSuccessMessage());
|
||||||
|
if (bonusPlus > 0) {
|
||||||
|
widgetList.add(getValueWithDescription(StringsLocalization.bonusPlus(), bonusPlus.toString()));
|
||||||
|
}
|
||||||
|
if (bonusMinus > 0) {
|
||||||
|
widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString()));
|
||||||
|
}
|
||||||
|
widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%'));
|
||||||
|
widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}'));
|
||||||
|
widgetList.add(getCoupons());
|
||||||
|
widgetList.add( new Expanded(child: new Center()));
|
||||||
|
widgetList.add(wrapButton(getScreenMargins(74.0), getScanButton()));
|
||||||
|
|
||||||
|
return new Column(
|
||||||
|
children: widgetList
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getScreenMargins(double bottom) {
|
getScreenMargins(double bottom) {
|
||||||
@@ -70,15 +102,97 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
return buildRaisedButton(title, () => startScanner(context, app, helper));
|
return buildRaisedButton(title, () => startScanner(context, app, helper));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExpansionPanelHeaderBuilder get headerBuilder {
|
||||||
|
return (BuildContext context, bool isExpanded) {
|
||||||
|
return new Text('Purchase details');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getCoupons() {
|
||||||
|
EdgeInsets margin = new EdgeInsets.only(left: 20.0, right: 20.0);
|
||||||
|
TextStyle titleStyle = Theme.of(context).textTheme.button.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: faqTitlesColor
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<Widget> detailsRows = <Widget>[];
|
||||||
|
|
||||||
|
// this.details.forEach((key, value) => detailsRows.add(
|
||||||
|
// new Text(key)
|
||||||
|
// new Row(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: <Widget>[
|
||||||
|
// new Text('1'),
|
||||||
|
// new Text('2'),
|
||||||
|
//
|
||||||
|
// new Container(
|
||||||
|
// margin: const EdgeInsets.only(right: 16.0),
|
||||||
|
// child: new CircleAvatar(child: new Text('D')),
|
||||||
|
// ),
|
||||||
|
// new Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: <Widget>[
|
||||||
|
// new Text(key, style: Theme.of(context).textTheme.subhead),
|
||||||
|
// new Container(
|
||||||
|
// margin: const EdgeInsets.only(top: 0.5),
|
||||||
|
// child: new Text(key)
|
||||||
|
// )
|
||||||
|
// ]
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
// ));
|
||||||
|
|
||||||
|
print(detailsRows.length);
|
||||||
|
|
||||||
|
return new Container(
|
||||||
|
margin: margin,
|
||||||
|
child: new Card(
|
||||||
|
child: new ExpansionTile(
|
||||||
|
//key: new PageStorageKey<Entry>(root),
|
||||||
|
title: new Text(
|
||||||
|
'Coupons',
|
||||||
|
style: titleStyle
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
new Container(
|
||||||
|
margin: margin,
|
||||||
|
padding: new EdgeInsets.only(top: 12.0, bottom: 20.0),
|
||||||
|
child: new Text('Coupons'),
|
||||||
|
decoration: new BoxDecoration(
|
||||||
|
border: new Border(
|
||||||
|
top: new BorderSide(
|
||||||
|
color: greyTextColor,
|
||||||
|
width: 0.5
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
getSuccessMessage() {
|
getSuccessMessage() {
|
||||||
return new Row(children: <Widget>[new Expanded(child: new Container(
|
return new Row(
|
||||||
margin: new EdgeInsets.only(top: 20.0), height: 64.0,
|
children: <Widget>[
|
||||||
decoration: new BoxDecoration(color: greenBackground),
|
new Expanded(child: new Container(
|
||||||
child: new Center(
|
margin: new EdgeInsets.only(top: 20.0), height: 64.0,
|
||||||
child: new Text(getMessageTitle(), textAlign: TextAlign.center,
|
decoration: new BoxDecoration(color: greenBackground),
|
||||||
style: new TextStyle(fontWeight: FontWeight.bold,
|
child: new Center(
|
||||||
color: tokenActiveTextColor)))))
|
child: new Text(
|
||||||
]);
|
getMessageTitle(), textAlign: TextAlign.center,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: tokenActiveTextColor
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMessageTitle() {
|
getMessageTitle() {
|
||||||
@@ -89,4 +203,4 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ class StringsLocalization {
|
|||||||
static String completePurchase() => Intl.message('complite_purchase', name: 'complite_purchase', locale: Intl.defaultLocale);
|
static String completePurchase() => Intl.message('complite_purchase', name: 'complite_purchase', locale: Intl.defaultLocale);
|
||||||
static String scan() => Intl.message('scan', name: 'scan', locale: Intl.defaultLocale);
|
static String scan() => Intl.message('scan', name: 'scan', locale: Intl.defaultLocale);
|
||||||
static String buyer() => Intl.message('buyer', name: 'buyer', locale: Intl.defaultLocale);
|
static String buyer() => Intl.message('buyer', name: 'buyer', locale: Intl.defaultLocale);
|
||||||
|
static String discountRate() => Intl.message('discount_rate', name: 'discount_rate', locale: Intl.defaultLocale);
|
||||||
|
static String discountSum() => Intl.message('discount_sum', name: 'discount_sum', locale: Intl.defaultLocale);
|
||||||
|
static String bonusPlus() => Intl.message('bonus_plus', name: 'bonus_plus', locale: Intl.defaultLocale);
|
||||||
|
static String bonusMinus() => Intl.message('bonus_minus', name: 'bonus_minus', locale: Intl.defaultLocale);
|
||||||
static String idNotFound() => Intl.message('ID_not_found', name: 'ID_not_found', locale: Intl.defaultLocale);
|
static String idNotFound() => Intl.message('ID_not_found', name: 'ID_not_found', locale: Intl.defaultLocale);
|
||||||
static String settings() => Intl.message('settings', name: 'settings', locale: Intl.defaultLocale);
|
static String settings() => Intl.message('settings', name: 'settings', locale: Intl.defaultLocale);
|
||||||
static String help() => Intl.message('help', name: 'help', locale: Intl.defaultLocale);
|
static String help() => Intl.message('help', name: 'help', locale: Intl.defaultLocale);
|
||||||
@@ -137,4 +141,4 @@ class StringsLocalization {
|
|||||||
static String supportGuide(String phone, String url) {
|
static String supportGuide(String phone, String url) {
|
||||||
return sprintf(Intl.message('support_guide', name: 'support_guide', locale: Intl.defaultLocale), [phone, url]);
|
return sprintf(Intl.message('support_guide', name: 'support_guide', locale: Intl.defaultLocale), [phone, url]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user