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

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 textFieldBackground = const Color(0xffefefef);
const Color tokenActiveTextColor = const Color(0xff1f5a1f); const Color tokenActiveTextColor = const Color(0xff1f5a1f);
const Color tokenActivateTextColor = const Color(0xff4e3a19); const Color tokenActivateTextColor = const Color(0xff4e3a19);
const Color greenBackground = const Color(0xff8ae28a);
// Margins // Margins
const double verticalMargin = 28.0; const double verticalMargin = 28.0;
@@ -70,7 +71,8 @@ startScanner(BuildContext context) async {
return result; return result;
}); });
Navigator.of(context).pop();
await platform.invokeMethod('startScanner'); await platform.invokeMethod('startScanner');
} }

View File

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

View File

@@ -27,12 +27,16 @@ class _PurchaseSuccessScreenState<T> extends PurchaseScreenState<T> {
return new Column(children: <Widget>[ return new Column(children: <Widget>[
getValueWithTitle('Покупатель', 'Знаменитый Рокер Паук'), getValueWithTitle('Покупатель', 'Знаменитый Рокер Паук'),
_getSuccessMessage(), _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() { _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)))))]);
} }
} }