From 42de9b8f1e78cb5a0f7f2ea9dd05d2c64c282ac4 Mon Sep 17 00:00:00 2001 From: kifio Date: Thu, 20 Jul 2017 08:44:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 3 ++- lib/registration.dart | 33 +++++++++++++-------------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 625d9ef..1427bcd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,9 +21,10 @@ const String splash_png = 'assets/splash.png'; const String logout_png = 'assets/logout.png'; const String activate_token_bg_png = 'assets/activate_token_message_background.png'; - // Colors const int primaryColor = 0xffeb0004; + +// HttpClient final httpClient = createHttpClient(); void main() { diff --git a/lib/registration.dart b/lib/registration.dart index 054c4c1..daa43d0 100644 --- a/lib/registration.dart +++ b/lib/registration.dart @@ -12,7 +12,6 @@ class RegistrationScreen extends StatefulWidget { class _RegistrationScreenState extends BaseState { String _merchantID = ""; - String _posID = ""; @override Widget build(BuildContext context) { return new Scaffold(appBar: _getAppBar(), body: _getScreen(context)); @@ -32,41 +31,36 @@ class _RegistrationScreenState extends BaseState { Widget _getScreen(BuildContext context) { return new Center(child: new Column(children: [ _getLogo(), - _getDecoratedInputField(merchantIDHint, 0.0), - _getDecoratedInputField(posIDHint, 36.0), + _getDecoratedInputField(), _getButton(context) ])); } - Container _getLogo() { return new Container(height: 192.0, child: new Image.asset(logo_png, height: 24.0, width: 156.0)); } - Container _getDecoratedInputField(String hint, double topPadding) { + Container _getDecoratedInputField() { return new Container( - padding: new EdgeInsets.only(left: 28.0, right: 28.0, top: topPadding), + padding: new EdgeInsets.only(left: 28.0, right: 28.0), child: new Container(height: 48.0, padding: new EdgeInsets.only(left: 16.0, right: 16.0), decoration: _getDecoraionForInputField(), - child: _getInputField(hint))) ; + child: _getInputField())) ; } - TextField _getInputField(String hint) { - return new TextField(decoration: new InputDecoration(hintText: hint, + TextField _getInputField() { + return new TextField(decoration: new InputDecoration(hintText: merchantIDHint, hideDivider: true, hintStyle: new TextStyle(color: const Color(0xffa5a5a5), - fontSize: 16.0)), onChanged: (text) => _handleUserInput(hint, text)); + fontSize: 16.0)), onChanged: (text) => _handleUserInput(text)); } - void _handleUserInput(String hint, String text) { + void _handleUserInput(String text) { if (text.length > 0) { setState(() { - if (hint == merchantIDHint) - _merchantID = text; - else if (hint == posIDHint) - _posID = text; + _merchantID = text; }); } } @@ -83,15 +77,14 @@ class _RegistrationScreenState extends BaseState { child: new Container(height: 64.0, padding: new EdgeInsets.all(8.0), child: new RaisedButton(child: new Text('ЗАРЕГИСТРИРОВАТЬ', style: new TextStyle(color: Colors.white)), - onPressed: _isFieldsAreFilled() ? () => _registerShop(context, _merchantID) : null, + onPressed: _isValidMerchantID() ? () => _registerShop(context, _merchantID) : null, disabledColor: const Color(0xffbfbfbf), - color: const Color(0xff3078c0)))); + color: primaryColor))); } - _isFieldsAreFilled() { + _isValidMerchantID() { print(_merchantID.length); - print(_posID.length); - return _merchantID.length == 5 && _posID.length > 0; + return _merchantID.length == 5; } void _registerShop(BuildContext context, String merchantShop) {