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

@ -11,36 +11,56 @@ class HeaderTitle extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreConnector<AppState, UserState>( return StoreConnector<AppState, UserState>(
converter: (store) => store.state.userState, converter: (store) => store.state.userState,
builder: (context, vm) { builder: (context, vm) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
width: 75, width: 75,
child: Image( child: Image(
image: AssetImage('assets/images/logo.png'), image: AssetImage('assets/images/logo.png'),
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
),
margin: const EdgeInsets.only(right: 15),
), ),
margin: const EdgeInsets.only(right: 15), Expanded(
), child: Column(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.start, Text(
children: <Widget>[ 'Пользователь: ${vm.user.email}',
Text('Пользователь: ${vm.user.email}', overflow: TextOverflow.fade, maxLines: 1, softWrap: false, style: TextStyle(fontSize: 13, color: Colors.black, ),), overflow: TextOverflow.fade,
vm.smena.message !=null maxLines: 1,
? Text(vm.smena.message, style: TextStyle(fontSize: 13, color: redColor) ) softWrap: false,
: vm.smena.startedAt !=null style: TextStyle(
? Text('Смена открыта', overflow: TextOverflow.fade, maxLines: 1, softWrap: false , style: TextStyle(fontSize: 13, color: Colors.black),) fontSize: 13,
: Text('Смена от:', style: TextStyle(fontSize: 13, color: Colors.black),), 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,17 +44,19 @@ 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();
} }
} }
@override @override
void dispose() { void dispose() {
emailController.dispose(); emailController.dispose();
passwordController.dispose(); passwordController.dispose();
super.dispose(); super.dispose();
@ -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,
),
], ],
), ),
@ -96,23 +104,26 @@ class _LoginViewState extends State<LoginView> {
), ),
verticalSpaceSmall, verticalSpaceSmall,
InputField( InputField(
placeholder: 'Пароль', placeholder: 'Пароль',
password: true, password: true,
controller: passwordController, controller: passwordController,
fieldFocusNode: passwordNode, fieldFocusNode: passwordNode,
additionalNote: vm.loginFormMessage.password, additionalNote: vm.loginFormMessage.password,
enterPressed: _pressBtnEnter, enterPressed: _pressBtnEnter,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
), ),
verticalSpaceMedium, verticalSpaceMedium,
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
BusyButton( SizedBox(
title: 'Войти', width: 150,
busy: vm.isLoading, child: BusyButton(
onPressed: _pressBtnEnter, title: 'Войти',
busy: vm.isLoading,
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) {
@ -188,4 +200,4 @@ class LoginModel {
final String login; final String login;
final String password; final String password;
LoginModel({this.authType, this.login, this.password}); LoginModel({this.authType, this.login, this.password});
} }

View File

@ -41,40 +41,46 @@ 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(
mainAxisAlignment: MainAxisAlignment.center, child: Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.center,
widget.icon != null children: <Widget>[
? Container( widget.icon != null
child: (Icon( ? Container(
widget.icon, child: (Icon(
color: whiteColor, widget.icon,
)), color: whiteColor,
margin: const EdgeInsets.only(right: 10.0), )),
) margin: const EdgeInsets.only(right: 10.0),
: (Container()), )
AutoSizeText( : (Container()),
widget.title, AutoSizeText(
textAlign: TextAlign.center, widget.title,
style: buttonTitleTextStyle, textAlign: TextAlign.center,
), style: buttonTitleTextStyle,
], ),
],
),
) )
: CircularProgressIndicator( : SizedBox(
strokeWidth: 2, width: 30,
valueColor: height: 30,
AlwaysStoppedAnimation<Color>(Colors.white)), child: CircularProgressIndicator(
strokeWidth: 2,
valueColor:
AlwaysStoppedAnimation<Color>(Colors.white)),
),
], ],
), ),
), ),