initial commit
This commit is contained in:
@@ -35,6 +35,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"common" : MessageLookupByLibrary.simpleMessage("General information"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("The activation request for the application has been sent, wait for confirm activation"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Reward"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bonus on account"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Scan"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Sign Up"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Specify the DIN store"),
|
||||
|
||||
@@ -32,6 +32,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"registration" : MessageLookupByLibrary.simpleMessage("El registro"),
|
||||
"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"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Bono por cuenta"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Escanear"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Registrarse"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Hay que dar DIN del negocio"),
|
||||
|
||||
@@ -35,6 +35,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"common" : MessageLookupByLibrary.simpleMessage("Общая информация"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запрос на активацию приложения отправлен, дождитесь подтверждения активации администратором"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Вознаграждение"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусов на счету"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканировать"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зарегистрироваться"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необходимо указать DIN магазина"),
|
||||
|
||||
@@ -35,6 +35,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"common" : MessageLookupByLibrary.simpleMessage("Загальна інформація"),
|
||||
"request_sent_wait_activ" : MessageLookupByLibrary.simpleMessage("Запит на активацію додатку відправлений, дочекайтеся підтвердження активації адміністратором"),
|
||||
"reward" : MessageLookupByLibrary.simpleMessage("Винагорода"),
|
||||
"bonus" : MessageLookupByLibrary.simpleMessage("Бонусів на рахунку"),
|
||||
"scan" : MessageLookupByLibrary.simpleMessage("Сканувати"),
|
||||
"sign_up" : MessageLookupByLibrary.simpleMessage("Зареєструватися"),
|
||||
"specify_din_store" : MessageLookupByLibrary.simpleMessage("Необхідно вказати DIN магазину"),
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:checker/screens/splash.dart';
|
||||
import 'package:checker/consts.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
const platform = const MethodChannel('com.dinect.checker/instance_id');
|
||||
|
||||
/// Точка входа в приложение.
|
||||
|
||||
|
||||
///
|
||||
|
||||
void main() {
|
||||
runApp(new Checker());
|
||||
platform.invokeMethod('getAppTitle').then((title) {
|
||||
runApp(new Checker(appName: title));
|
||||
});
|
||||
}
|
||||
|
||||
class Checker extends StatelessWidget {
|
||||
Checker({this.appName});
|
||||
final String appName;
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
@override Widget build (BuildContext context) {
|
||||
print('app name = ${appName}');
|
||||
return new MaterialApp(
|
||||
title: appName,
|
||||
home: new SplashScreen());
|
||||
home: new SplashScreen()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -50,24 +50,37 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
Map user;
|
||||
String card = '';
|
||||
String loyalty = '';
|
||||
String bonus = '';
|
||||
bool dataLoaded = false;
|
||||
|
||||
@override
|
||||
Widget getScreenContent() {
|
||||
List<Widget> widgets = [];
|
||||
widgets.add(getValueWithDescription(
|
||||
StringsLocalization.buyer(),
|
||||
user['first_name'] == null ? '' : user['first_name']
|
||||
));
|
||||
widgets.add(getValueWithDescription(StringsLocalization.card(), card));
|
||||
|
||||
if (bonus.length > 0) {
|
||||
widgets.add(getValueWithDescription(StringsLocalization.bonus(), bonus));
|
||||
}
|
||||
|
||||
widgets.add(getValueWithDescription(StringsLocalization.reward(), loyalty));
|
||||
widgets.add(getHintLabel());
|
||||
widgets.add(getInputField());
|
||||
widgets.add(wrapButton(getScreenMargins(36.0), getCompleteButton()));
|
||||
widgets.add(wrapButton(
|
||||
getScreenMargins(24.0),
|
||||
getScanButton(
|
||||
context,
|
||||
StringsLocalization.scan(),
|
||||
Resources.getPrimaryColor(app)
|
||||
)
|
||||
));
|
||||
return new Column(children: <Widget>[
|
||||
new Expanded(
|
||||
child: new ListView(children: <Widget>[
|
||||
getValueWithDescription(StringsLocalization.buyer(),
|
||||
user['first_name'] == null ? '' : user['first_name']),
|
||||
getValueWithDescription(StringsLocalization.card(), card),
|
||||
getValueWithDescription(StringsLocalization.reward(), loyalty),
|
||||
getHintLabel(),
|
||||
getInputField(),
|
||||
wrapButton(getScreenMargins(36.0), getCompleteButton()),
|
||||
wrapButton(
|
||||
getScreenMargins(24.0),
|
||||
getScanButton(context, StringsLocalization.scan(),
|
||||
Resources.getPrimaryColor(app)))
|
||||
]))
|
||||
child: new ListView(children: widgets))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -122,12 +135,13 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
}
|
||||
|
||||
requestLoyalty(String url) async {
|
||||
print(url);
|
||||
if (await platform.invokeMethod('isOnline')) {
|
||||
bool showBonus = await platform.invokeMethod('showBonus');
|
||||
if (await platform.invokeMethod('isOnline') && !this.dataLoaded) {
|
||||
getLoyaltyRequest(url, helper).then((response) {
|
||||
print(response);
|
||||
this.dataLoaded = true;
|
||||
setState(() {
|
||||
setBonuses(JSON.decode(response.body));
|
||||
setBonuses(JSON.decode(response.body), showBonus );
|
||||
});
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
@@ -245,7 +259,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void setBonuses(Map bonuses) {
|
||||
void setBonuses(Map bonuses, bool showBonus) {
|
||||
print('kifio ' + bonuses['type']);
|
||||
if (bonuses['type'] == 'amount') {
|
||||
this.loyalty = '${user['discount']}%';
|
||||
@@ -254,6 +268,11 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
bonuses['amount_to_bonus'][0]) * 100;
|
||||
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
|
||||
}
|
||||
|
||||
if (showBonus && (bonuses['type'] == 'bonus')) {
|
||||
this.bonus = '${user['bonus']}';
|
||||
}
|
||||
print('kifio ' + this.loyalty);
|
||||
print('bonus ' + this.bonus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ class StringsLocalization {
|
||||
static String card() => Intl.message('card', name: 'card', locale: Intl.defaultLocale);
|
||||
static String reward() => Intl.message('reward', name: 'reward', locale: Intl.defaultLocale);
|
||||
static String sum() => Intl.message('sum', name: 'sum', locale: Intl.defaultLocale);
|
||||
static String bonus() => Intl.message('bonus', name: 'bonus', locale: Intl.defaultLocale);
|
||||
static String carryingPurchase() => Intl.message('carry_purchase', name: 'carry_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);
|
||||
|
||||
Reference in New Issue
Block a user