ui busy button fix

4.4
Serik Uvaissov 2020-07-14 16:35:13 +06:00
parent 14d035ecc9
commit 5772a5efab
5 changed files with 127 additions and 83 deletions

View File

@ -30,6 +30,8 @@ PODS:
- SwiftProtobuf (1.9.0) - SwiftProtobuf (1.9.0)
- url_launcher (0.0.1): - url_launcher (0.0.1):
- Flutter - Flutter
- url_launcher_linux (0.0.1):
- Flutter
- url_launcher_macos (0.0.1): - url_launcher_macos (0.0.1):
- Flutter - Flutter
- url_launcher_web (0.0.1): - url_launcher_web (0.0.1):
@ -48,6 +50,7 @@ DEPENDENCIES:
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
@ -82,6 +85,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/ios" :path: ".symlinks/plugins/sqflite/ios"
url_launcher: url_launcher:
:path: ".symlinks/plugins/url_launcher/ios" :path: ".symlinks/plugins/url_launcher/ios"
url_launcher_linux:
:path: ".symlinks/plugins/url_launcher_linux/ios"
url_launcher_macos: url_launcher_macos:
:path: ".symlinks/plugins/url_launcher_macos/ios" :path: ".symlinks/plugins/url_launcher_macos/ios"
url_launcher_web: url_launcher_web:
@ -103,6 +108,7 @@ SPEC CHECKSUMS:
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0
url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c

View File

@ -392,7 +392,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 94BM6VL7L8; DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -531,7 +531,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 94BM6VL7L8; DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -563,7 +563,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 94BM6VL7L8; DEVELOPMENT_TEAM = 94BM6VL7L8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (

View File

@ -29,18 +29,38 @@ class HeaderTitle extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text('Пользователь: ${vm.user.email}', overflow: TextOverflow.fade, maxLines: 1, softWrap: false, style: TextStyle(fontSize: 13, color: Colors.black, ),), Text(
vm.smena.message !=null 'Пользователь: ${vm.user.email}',
? Text(vm.smena.message, style: TextStyle(fontSize: 13, color: redColor) ) overflow: TextOverflow.fade,
: vm.smena.startedAt !=null maxLines: 1,
? Text('Смена открыта', overflow: TextOverflow.fade, maxLines: 1, softWrap: false , style: TextStyle(fontSize: 13, color: Colors.black),) softWrap: false,
: Text('Смена от:', style: TextStyle(fontSize: 13, color: Colors.black),), style: TextStyle(
fontSize: 13,
color: Colors.black,
),
),
vm.smena.message != null
? Text(vm.smena.message,
style: TextStyle(fontSize: 13, color: redColor))
: vm.smena.startedAt != null
? Text(
'Смена открыта',
overflow: TextOverflow.fade,
maxLines: 1,
softWrap: false,
style: TextStyle(
fontSize: 13, color: Colors.black),
)
: Text(
'',
style: TextStyle(
fontSize: 13, color: Colors.black),
),
], ],
), ),
) )
], ],
); );
} });
);
} }
} }

View File

@ -29,8 +29,7 @@ class LoginView extends StatefulWidget {
} }
class _LoginViewState extends State<LoginView> { class _LoginViewState extends State<LoginView> {
TextEditingController emailController;
TextEditingController emailController ;
TextEditingController passwordController; TextEditingController passwordController;
@ -45,9 +44,11 @@ class _LoginViewState extends State<LoginView> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if(widget.loginModel!=null && widget.loginModel.authType == AuthenticateTypeLogin) { if (widget.loginModel != null &&
widget.loginModel.authType == AuthenticateTypeLogin) {
emailController = TextEditingController(text: widget.loginModel.login); emailController = TextEditingController(text: widget.loginModel.login);
passwordController = TextEditingController(text: widget.loginModel.password); passwordController =
TextEditingController(text: widget.loginModel.password);
} else { } else {
emailController = TextEditingController(); emailController = TextEditingController();
passwordController = TextEditingController(); passwordController = TextEditingController();
@ -83,7 +84,14 @@ class _LoginViewState extends State<LoginView> {
height: 150, height: 150,
child: Image.asset('assets/images/logo.png'), child: Image.asset('assets/images/logo.png'),
), ),
Positioned(child: Text('онлайн касса', style: TextStyle(fontWeight: FontWeight.bold),), bottom: 23.0,left: 25.0,), Positioned(
child: Text(
'онлайн касса',
style: TextStyle(fontWeight: FontWeight.bold),
),
bottom: 23.0,
left: 25.0,
),
], ],
), ),
@ -109,10 +117,13 @@ class _LoginViewState extends State<LoginView> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
BusyButton( SizedBox(
width: 150,
child: BusyButton(
title: 'Войти', title: 'Войти',
busy: vm.isLoading, busy: vm.isLoading,
onPressed: _pressBtnEnter, onPressed: _pressBtnEnter,
),
) )
], ],
), ),
@ -134,7 +145,8 @@ class _LoginViewState extends State<LoginView> {
} }
_pressBtnEnter() async { _pressBtnEnter() async {
if(emailController.text!=null && emailController.text.toLowerCase().trim().startsWith('test')){ if (emailController.text != null &&
emailController.text.toLowerCase().trim().startsWith('test')) {
_apiService.test = true; _apiService.test = true;
} else { } else {
_apiService.test = false; _apiService.test = false;
@ -158,13 +170,13 @@ class _LoginViewState extends State<LoginView> {
// .formatNote); // If a unknown format was scanned this field contains a note // .formatNote); // If a unknown format was scanned this field contains a note
if (result.type == ResultType.Barcode && if (result.type == ResultType.Barcode &&
result.rawContent?.length == 60) { result.rawContent?.length == 60) {
if(result.rawContent.toLowerCase().trim().startsWith('test')){ if (result.rawContent.toLowerCase().trim().startsWith('test')) {
_apiService.test = true; _apiService.test = true;
} else { } else {
_apiService.test = false; _apiService.test = false;
} }
Redux.store.dispatch(authenticateToken(result.rawContent)); Redux.store.dispatch(authenticateToken(result.rawContent));
} else if (result.type == ResultType.Error ) { } else if (result.type == ResultType.Error) {
_dialogService.showDialog(description: 'Не верный формат QR кода'); _dialogService.showDialog(description: 'Не верный формат QR кода');
} }
} on PlatformException catch (e) { } on PlatformException catch (e) {

View File

@ -41,18 +41,19 @@ class _BusyButtonState extends State<BusyButton> {
child: InkWell( child: InkWell(
onTap: widget.busy || !widget.enabled ? null : widget.onPressed, onTap: widget.busy || !widget.enabled ? null : widget.onPressed,
child: AnimatedContainer( child: AnimatedContainer(
height: widget.busy ? 40 : 40, height: widget.busy ? 45 : 45,
//width: widget.busy ? 40 : 40, //width: widget.busy ? 40 : 40,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: widget.busy ? 10 : 25, horizontal: widget.busy ? 10 : 25,
vertical: widget.busy ? 10 : 15), vertical: widget.busy ? 10 : 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
!widget.busy !widget.busy
? Row( ? Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
widget.icon != null widget.icon != null
@ -70,11 +71,16 @@ class _BusyButtonState extends State<BusyButton> {
style: buttonTitleTextStyle, style: buttonTitleTextStyle,
), ),
], ],
),
) )
: CircularProgressIndicator( : SizedBox(
width: 30,
height: 30,
child: CircularProgressIndicator(
strokeWidth: 2, strokeWidth: 2,
valueColor: valueColor:
AlwaysStoppedAnimation<Color>(Colors.white)), AlwaysStoppedAnimation<Color>(Colors.white)),
),
], ],
), ),
), ),