Skip to content

Commit

Permalink
fix: The description of the camera permission was going outside the b…
Browse files Browse the repository at this point in the history
…ox in some devices. (#530)
  • Loading branch information
duckcommit authored Mar 26, 2024
1 parent 3bf8c18 commit 498ac7d
Showing 1 changed file with 76 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,75 +526,85 @@ class AddOrUpdateAlarmController extends GetxController {

if (!cameraStatus.isGranted) {
Get.defaultDialog(
backgroundColor: themeController.isLightMode.value
? kLightSecondaryBackgroundColor
: ksecondaryBackgroundColor,
title: 'Camera Permission'.tr,
titleStyle: TextStyle(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: Colors.white,
),
titlePadding: const EdgeInsets.only(
top: 25,
left: 10,
),
contentPadding: const EdgeInsets.only(top: 20, left: 20, bottom: 23),
content: Text('Please allow camera access to scan QR codes.'.tr),
onCancel: () {
Get.back(); // Close the alert box
},
onConfirm: () async {
Get.back(); // Close the alert box
PermissionStatus permissionStatus = await Permission.camera.request();
if (permissionStatus.isGranted) {
// Permission granted, proceed with QR code scanning
showQRDialog();
}
},
confirm: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(kprimaryColor),
),
child: Text(
'OK',
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: ksecondaryTextColor,
),
),
onPressed: () async {
Get.back(); // Close the alert box
PermissionStatus permissionStatus =
await Permission.camera.request();
if (permissionStatus.isGranted) {
// Permission granted, proceed with QR code scanning
showQRDialog();
}
},
backgroundColor: themeController.isLightMode.value
? kLightSecondaryBackgroundColor
: ksecondaryBackgroundColor,
title: 'Camera Permission'.tr,
titleStyle: TextStyle(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: Colors.white,
),
titlePadding: const EdgeInsets.only(
top: 25,
left: 10,
),
contentPadding: const EdgeInsets.only(top: 20, left: 20, right: 20,bottom: 23),
content: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(
'Please allow camera access to scan QR codes.'.tr,
textAlign: TextAlign.center,
),
cancel: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.5)
: kprimaryTextColor.withOpacity(0.5),
),
),
],
),
onCancel: () {
Get.back(); // Close the alert box
},
onConfirm: () async {
Get.back(); // Close the alert box
PermissionStatus permissionStatus = await Permission.camera.request();
if (permissionStatus.isGranted) {
// Permission granted, proceed with QR code scanning
showQRDialog();
}
},
confirm: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(kprimaryColor),
),
child: Text(
'OK',
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: ksecondaryTextColor,
),
child: Text(
'Cancel',
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: kprimaryTextColor,
),
),
onPressed: () async {
Get.back(); // Close the alert box
PermissionStatus permissionStatus =
await Permission.camera.request();
if (permissionStatus.isGranted) {
// Permission granted, proceed with QR code scanning
showQRDialog();
}
},
),
cancel: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.5)
: kprimaryTextColor.withOpacity(0.5),
),
),
child: Text(
'Cancel',
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
: kprimaryTextColor,
),
onPressed: () {
Get.back(); // Close the alert box
},
),
);
),
onPressed: () {
Get.back(); // Close the alert box
},
),
);
} else {
showQRDialog();
}
Expand Down

0 comments on commit 498ac7d

Please sign in to comment.