Поправил отзывчивость кнопок валют на экране валюты, исправил отображение названий валюты на экранах проведения покупки (рубль, рубля, рублей) для русской локали

This commit is contained in:
kifio
2017-09-12 09:38:17 +03:00
parent e8788f72a3
commit d23ca1c991
16 changed files with 292 additions and 137 deletions

View File

@@ -1,26 +1,36 @@
import 'package:flutter/material.dart';
import 'package:checker/base/base_state.dart';
import 'package:checker/common.dart';
import 'package:checker/consts.dart';
import 'package:checker/db.dart';
import 'package:checker/strings.dart';
import 'package:checker/base/base_state.dart';
import 'package:flutter/material.dart';
/// Экран проведения покупки.
class PurchaseSuccessScreen extends StatefulWidget {
PurchaseSuccessScreen(this.val, this.name);
PurchaseSuccessScreen(this.val, this.name, this.helper, this.app);
final String val;
final String name;
final String app;
final SqliteHelper helper;
@override State createState() => new PurchaseSuccessScreenState(val, name);
@override State createState() =>
new PurchaseSuccessScreenState(val, name, helper, app);
}
class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
PurchaseSuccessScreenState(this.sum, this.username);
PurchaseSuccessScreenState(String sum, String username, SqliteHelper helper,
String app) {
this.sum = sum;
this.username = username;
this.helper = helper;
this.app = app;
}
String sum;
String username;
String sum, username;
int currency;
@override String getTitle() {
return StringsLocalization.carryingPurchase();
@@ -30,6 +40,17 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
return null;
}
@override Widget build(BuildContext context) {
if (currency == null) {
helper.getCurrency().then((currency) {
setState(() {
this.currency = currency;
});
});
}
return getMainWidget();
}
@override Widget getScreenContent() {
return new Column(children: <Widget>[
getValueWithDescription(StringsLocalization.buyer(), username),
@@ -50,14 +71,22 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
}
getSuccessMessage() {
return new Row(children: <Widget>[new Expanded(child: new Container(margin: new EdgeInsets.only(top: 20.0), height: 64.0,
decoration: new BoxDecoration(color: greenBackground),
child: new Center(child: new Text(getMessageTitle(), textAlign: TextAlign.center,
style: new TextStyle(fontWeight: FontWeight.bold, color: tokenActiveTextColor)))))]);
return new Row(children: <Widget>[new Expanded(child: new Container(
margin: new EdgeInsets.only(top: 20.0), height: 64.0,
decoration: new BoxDecoration(color: greenBackground),
child: new Center(
child: new Text(getMessageTitle(), textAlign: TextAlign.center,
style: new TextStyle(fontWeight: FontWeight.bold,
color: tokenActiveTextColor)))))
]);
}
getMessageTitle() {
return StringsLocalization.purchaseCompleted(sum);
if (currency != null) {
return StringsLocalization.purchaseCompleted(sum, currency);
} else {
return '';
}
}
}