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

View File

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