Сделал экраны Проведения покупки

This commit is contained in:
Ivan Murashov
2017-07-24 12:44:17 +03:00
parent 8dcae4c256
commit 355c05cf06
3 changed files with 24 additions and 23 deletions

View File

@@ -31,6 +31,7 @@ const Color textBorderColor = const Color(0xffcfd8dc);
const Color textFieldBackground = const Color(0xffefefef);
const Color tokenActiveTextColor = const Color(0xff1f5a1f);
const Color tokenActivateTextColor = const Color(0xff4e3a19);
const Color greenBackground = const Color(0xff8ae28a);
// Margins
const double verticalMargin = 28.0;
@@ -71,6 +72,7 @@ startScanner(BuildContext context) async {
});
Navigator.of(context).pop();
await platform.invokeMethod('startScanner');
}

View File

@@ -32,7 +32,7 @@ class PurchaseScreenState<T> extends BaseState<T> {
}
@override Widget getScreenContent() {
return new Container(height: 398.0,
return new Container(height: 412.0,
child: new ListView(reverse: true, children: <Widget>[
new Column(children: <Widget>[
getValueWithTitle('ФИО', 'Знаменитый Рокер Паук'),
@@ -40,38 +40,33 @@ class PurchaseScreenState<T> extends BaseState<T> {
getValueWithTitle('Вознаграждение', '100%'),
getHintLabel(),
getDecoratedTextWidget(),
getApprovePurchaseButton(context),
buildScanButton(context)])
buildButton(new EdgeInsets.only(top: 36.0, left: 70.0, right: 70.0), buildRaisedButton(context, 'ЗАВЕРШИТЬ ПОКУПКУ', () => _purchase(context))),
buildButton(new EdgeInsets.only(top: 24.0, left: 70.0, right: 70.0), buildFlatButton(context, 'СКАНИРОВАТЬ', primaryColor))])
].reversed.toList()));
}
Widget getValueWithTitle(String title, String value) {
return new Container(padding: new EdgeInsets.only(left: verticalMargin, right: verticalMargin, top: 12.0),
return new Container(padding: new EdgeInsets.only(left: verticalMargin, right: verticalMargin, top: 18.0),
child: new Column(children: <Widget>[
new Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[new Text(title, textAlign: TextAlign.left, style: new TextStyle(color: greyTextColor, fontSize: 14.0))]),
new Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[new Text(value, textAlign: TextAlign.left, style: new TextStyle(color: Colors.black, fontSize: 20.0))])
]));
}
Widget getApprovePurchaseButton(BuildContext context) {
return new Container(margin: new EdgeInsets.only(top: 36.0), height: 44.0,
child: new RaisedButton(child: new Text('ЗАВЕРШИТЬ ПОКУПКУ',
Widget buildButton(EdgeInsets margin, Widget widget) {
return new Container(margin: margin, height: 48.0, child: new Row(children: <Widget>[new Expanded(child: widget)]));
}
Widget buildRaisedButton(BuildContext context, String text, VoidCallback onPressed) {
return new RaisedButton(child: new Text(text,
style: new TextStyle(color: Colors.white)),
onPressed: () => _purchase(context),
color: primaryColor));
onPressed: onPressed,
color: primaryColor);
}
Widget buildScanButton(BuildContext context) {
return new Container(margin: new EdgeInsets.only(top: 24.0, left: 70.0, right: 70.0), child: _getScanButtonRow(context));
}
Widget _getScanButtonRow(BuildContext context) {
return new Row(children: <Widget>[new Expanded(child: _getScanButton(context))]);
}
Widget _getScanButton(BuildContext context) {
return new Container(height: 44.0, child: new FlatButton(child: new Text('СКАНИРОВАТЬ',
style: new TextStyle(color: primaryColor)),
Widget buildFlatButton(BuildContext context, String title, Color textColor) {
return new Container(height: 48.0, child: new FlatButton(child: new Text(title,
style: new TextStyle(color: textColor)),
onPressed: () => startScanner(context)),
decoration: _getDecoraionForScanButton());
}

View File

@@ -27,12 +27,16 @@ class _PurchaseSuccessScreenState<T> extends PurchaseScreenState<T> {
return new Column(children: <Widget>[
getValueWithTitle('Покупатель', 'Знаменитый Рокер Паук'),
_getSuccessMessage(),
getApprovePurchaseButton(context)
new Expanded(child: new Center()),
buildButton(new EdgeInsets.only(bottom: 74.0, left: 70.0, right: 70.0), buildRaisedButton(context, 'СКАНИРОВАТЬ', () => startScanner(context)))
]);
}
_getSuccessMessage() {
return new Container(height: 64.0, decoration: new BoxDecoration(color: const Color(0x8ae28aff)), child: new Text('Покупка на сумму 1234.00 руб. проведена', style: new TextStyle(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('Покупка на сумму 1234.00 руб. проведена', textAlign: TextAlign.center,
style: new TextStyle(fontWeight: FontWeight.bold, color: tokenActiveTextColor)))))]);
}
}