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

View File

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

View File

@ -11,36 +11,56 @@ class HeaderTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, UserState>(
converter: (store) => store.state.userState,
builder: (context, vm) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 75,
child: Image(
image: AssetImage('assets/images/logo.png'),
fit: BoxFit.fitWidth,
converter: (store) => store.state.userState,
builder: (context, vm) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 75,
child: Image(
image: AssetImage('assets/images/logo.png'),
fit: BoxFit.fitWidth,
),
margin: const EdgeInsets.only(right: 15),
),
margin: const EdgeInsets.only(right: 15),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Пользователь: ${vm.user.email}', overflow: TextOverflow.fade, maxLines: 1, softWrap: false, 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),),
],
),
)
],
);
}
);
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Пользователь: ${vm.user.email}',
overflow: TextOverflow.fade,
maxLines: 1,
softWrap: false,
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> {
TextEditingController emailController ;
TextEditingController emailController;
TextEditingController passwordController;
@ -45,12 +44,14 @@ class _LoginViewState extends State<LoginView> {
@override
void 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);
passwordController = TextEditingController(text: widget.loginModel.password);
passwordController =
TextEditingController(text: widget.loginModel.password);
} else {
emailController = TextEditingController();
passwordController = TextEditingController();
passwordController = TextEditingController();
}
}
@ -83,7 +84,14 @@ class _LoginViewState extends State<LoginView> {
height: 150,
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,
InputField(
placeholder: 'Пароль',
password: true,
controller: passwordController,
fieldFocusNode: passwordNode,
additionalNote: vm.loginFormMessage.password,
enterPressed: _pressBtnEnter,
textInputAction: TextInputAction.done,
placeholder: 'Пароль',
password: true,
controller: passwordController,
fieldFocusNode: passwordNode,
additionalNote: vm.loginFormMessage.password,
enterPressed: _pressBtnEnter,
textInputAction: TextInputAction.done,
),
verticalSpaceMedium,
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
BusyButton(
title: 'Войти',
busy: vm.isLoading,
onPressed: _pressBtnEnter,
SizedBox(
width: 150,
child: BusyButton(
title: 'Войти',
busy: vm.isLoading,
onPressed: _pressBtnEnter,
),
)
],
),
@ -134,7 +145,8 @@ class _LoginViewState extends State<LoginView> {
}
_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;
} else {
_apiService.test = false;
@ -158,13 +170,13 @@ class _LoginViewState extends State<LoginView> {
// .formatNote); // If a unknown format was scanned this field contains a note
if (result.type == ResultType.Barcode &&
result.rawContent?.length == 60) {
if(result.rawContent.toLowerCase().trim().startsWith('test')){
_apiService.test = true;
} else {
_apiService.test = false;
}
if (result.rawContent.toLowerCase().trim().startsWith('test')) {
_apiService.test = true;
} else {
_apiService.test = false;
}
Redux.store.dispatch(authenticateToken(result.rawContent));
} else if (result.type == ResultType.Error ) {
} else if (result.type == ResultType.Error) {
_dialogService.showDialog(description: 'Не верный формат QR кода');
}
} on PlatformException catch (e) {

View File

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