Начал экран успешного проведения покупки
This commit is contained in:
@@ -4,19 +4,17 @@ import 'dart:convert';
|
||||
import 'dart:async';
|
||||
|
||||
import 'main.dart';
|
||||
import 'activate_token.dart';
|
||||
import 'base_state.dart';
|
||||
import 'purchase_success.dart';
|
||||
|
||||
/// Экран проведения покупки.
|
||||
class PurchaseScreen extends StatefulWidget {
|
||||
@override State createState() => new _PurchaseScreenState();
|
||||
@override State createState() => new PurchaseScreenState<PurchaseScreen>();
|
||||
}
|
||||
|
||||
class _PurchaseScreenState extends BaseState<PurchaseScreen> {
|
||||
class PurchaseScreenState<T> extends BaseState<T> {
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return new Scaffold(appBar: getAppBar(), body: _getScreen(context));
|
||||
}
|
||||
String _sum = "1234.00";
|
||||
|
||||
@override String getTitle() {
|
||||
return "Проведение покупки";
|
||||
@@ -26,29 +24,28 @@ class _PurchaseScreenState extends BaseState<PurchaseScreen> {
|
||||
return 'Сумма';
|
||||
}
|
||||
|
||||
@overide getMenuButtons() {
|
||||
return <Widget>[new IconButton(icon: new Icon(Icons.help_outline), onPressed: () {})];
|
||||
@overide getMenuButtons(BuildContext context) {
|
||||
return <Widget>[
|
||||
new IconButton(icon: new Icon(Icons.help_outline), onPressed: () {}),
|
||||
new IconButton(icon: new Image.asset(logout_png, height: 20.0, width: 20.0), onPressed: () => logout(context))
|
||||
];
|
||||
}
|
||||
|
||||
Widget _getScreen(BuildContext context) {
|
||||
return new Stack(children: <Widget>[_getScreenContent(context), getProgressIndicator()]);
|
||||
}
|
||||
|
||||
Widget _getScreenContent(BuildContext context) {
|
||||
@override Widget getScreenContent() {
|
||||
return new Container(height: 398.0,
|
||||
child: new ListView(reverse: true, children: <Widget>[
|
||||
new Column(children: <Widget>[
|
||||
_getValueWithTitle('ФИО', 'Знаменитый Рокер Паук'),
|
||||
_getValueWithTitle('Карта', 'B0399900702'),
|
||||
_getValueWithTitle('Вознаграждение', '100%'),
|
||||
getValueWithTitle('ФИО', 'Знаменитый Рокер Паук'),
|
||||
getValueWithTitle('Карта', 'B0399900702'),
|
||||
getValueWithTitle('Вознаграждение', '100%'),
|
||||
getHintLabel(),
|
||||
getDecoratedTextWidget(),
|
||||
_getApprovePurchaseButton(context),
|
||||
_getScanButton(context)])
|
||||
getApprovePurchaseButton(context),
|
||||
buildScanButton(context)])
|
||||
].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),
|
||||
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))]),
|
||||
@@ -56,29 +53,53 @@ class _PurchaseScreenState extends BaseState<PurchaseScreen> {
|
||||
]));
|
||||
}
|
||||
|
||||
Widget _getApprovePurchaseButton(BuildContext context) {
|
||||
return new Container(margin: new EdgeInsets.only(top: 36.0), height: 42.0,
|
||||
child: new RaisedButton(child: new Text('ЗАФИКСИРОВАТЬ ПОКУПКУ',
|
||||
Widget getApprovePurchaseButton(BuildContext context) {
|
||||
return new Container(margin: new EdgeInsets.only(top: 36.0), height: 44.0,
|
||||
child: new RaisedButton(child: new Text('ЗАВЕРШИТЬ ПОКУПКУ',
|
||||
style: new TextStyle(color: Colors.white)),
|
||||
onPressed: () => _purchase(),
|
||||
onPressed: () => _purchase(context),
|
||||
color: primaryColor));
|
||||
}
|
||||
|
||||
Widget _getScanButton(BuildContext context) {
|
||||
return new Container(margin: new EdgeInsets.only(top: 36.0), height: 42.0,
|
||||
child: new RaisedButton(child: new Container(height: 42.0, child: new Text('СКАНИРОВАТЬ',
|
||||
style: new TextStyle(color: Colors.white)),
|
||||
decoration: getDecoraionForScanButton()),
|
||||
onPressed: () => _purchase()));
|
||||
Widget buildScanButton(BuildContext context) {
|
||||
return new Container(margin: new EdgeInsets.only(top: 24.0, left: 70.0, right: 70.0), child: _getScanButtonRow(context));
|
||||
}
|
||||
|
||||
getDecoraionForScanButton() {
|
||||
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)),
|
||||
decoration: _getDecoraionForScanButton());
|
||||
}
|
||||
|
||||
_getDecoraionForScanButton() {
|
||||
return new BoxDecoration(
|
||||
border: new Border.all(color: primaryColor, width: 1.0),
|
||||
borderRadius: new BorderRadius.all(new Radius.circular(4.0)));
|
||||
}
|
||||
|
||||
_purchase() {
|
||||
_purchase(BuildContext context) {
|
||||
showDialog(context: context, child: new AlertDialog(
|
||||
title: new Text('Подтверждение'),
|
||||
content: new Text('Вы подтверждаете покупку на ${_sum} руб?'),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: new Text('Нет'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
new FlatButton(
|
||||
child: new Text('Дат'),
|
||||
onPressed: () {
|
||||
pushRoute(context, new PurchaseSuccessScreen());
|
||||
},
|
||||
)
|
||||
]));
|
||||
print('purchase');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user