permission fix

backend_nfc
error500 2021-08-31 13:31:23 +06:00
parent 1c7730bf2e
commit 583b7b74e9
2 changed files with 81 additions and 68 deletions

View File

@ -70,75 +70,78 @@ class _LoginViewState extends State<LoginView> {
return Scaffold(
key: _scaffoldKey,
backgroundColor: fillColor,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Stack(
alignment: Alignment.bottomLeft,
children: <Widget>[
SizedBox(
height: 150,
child: Image.asset('assets/images/logo.png'),
),
Positioned(
child: Text(
'онлайн касса',
style: TextStyle(fontWeight: FontWeight.bold),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Stack(
alignment: Alignment.bottomLeft,
children: <Widget>[
SizedBox(
height: 150,
child: Image.asset('assets/images/logo.png'),
),
bottom: 23.0,
left: 25.0,
),
],
),
Positioned(
child: Text(
'онлайн касса',
style: TextStyle(fontWeight: FontWeight.bold),
),
bottom: 23.0,
left: 25.0,
),
],
),
InputField(
placeholder: 'Электронная почта',
controller: emailController,
textInputType: TextInputType.emailAddress,
nextFocusNode: passwordNode,
additionalNote: vm.loginFormMessage.email,
),
verticalSpaceSmall,
InputField(
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: [
SizedBox(
width: 150,
child: BusyButton(
title: 'Войти',
busy: vm.isLoading,
onPressed: _pressBtnEnter,
),
)
],
),
verticalSpaceLarge,
InputField(
placeholder: 'Электронная почта',
controller: emailController,
textInputType: TextInputType.emailAddress,
nextFocusNode: passwordNode,
additionalNote: vm.loginFormMessage.email,
),
verticalSpaceSmall,
InputField(
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: [
SizedBox(
width: 150,
child: BusyButton(
title: 'Войти',
busy: vm.isLoading,
onPressed: _pressBtnEnter,
),
)
],
),
verticalSpaceLarge,
// TextLink(
// 'Регистрация',
// onPressed: () {},
// ),
IconButton(
icon: Icon(MdiIcons.qrcodeScan),
iconSize: 40,
tooltip: "Scan",
onPressed: scan,
)
],
IconButton(
icon: Icon(MdiIcons.qrcodeScan),
iconSize: 40,
tooltip: "Scan",
onPressed: scan,
)
],
),
),
));
});

View File

@ -174,13 +174,23 @@ class _SettingPrinterViewState extends State<SettingPrinterView> {
confirmationTitle: 'Хорошо',
);
if (response.confirmed) {
if (await Permission.locationAlways
.request()
.isGranted) {
print('Granted');
PermissionStatus location = await Permission.location
.request();
if (location.isGranted ) {
PermissionStatus locationAlways = await Permission.locationAlways
.request();
if(locationAlways.isGranted) {
print('Granted');
} else {
_dialogService.showDialog(
description: 'Необходимо указать постоянный доступ к местоположении для поиска принтера');
_navigatorService.pop();
}
} else {
_dialogService.showDialog(
description: 'Необходимо указать постоянный доступ к местоположении для поиска принтера');
description: 'Необходимо указать доступ к местоположении для поиска принтера');
_navigatorService.pop();
}
} else {