Skip to content

Commit

Permalink
update radio button with checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-ishita-g committed Dec 17, 2024
1 parent d5c1909 commit 853c381
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions app/lib/ui/flow/permission/enable_permission_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ class _EnablePermissionViewState extends ConsumerState<EnablePermissionView>
_permissionView(
title: context.l10n.enable_location_access_title,
subTitle: context.l10n.enable_location_access_sub_title,
buttonValue: state.isLocationGranted,
onTapRadio: notifier.requestLocationPermission,
isChecked: state.isLocationGranted,
onChanged: notifier.requestLocationPermission,
),
const SizedBox(height: 24),
_permissionView(
title: context.l10n.enable_background_location_access_title,
subTitle: context.l10n.enable_background_location_access_sub_title,
buttonValue: state.isBackGroundLocationGranted,
onTapRadio: notifier.requestBackgroundLocationPermission,
isChecked: state.isBackGroundLocationGranted,
onChanged: notifier.requestBackgroundLocationPermission,
),
const SizedBox(height: 24),
_permissionView(
title: context.l10n.enable_notification_access_title,
subTitle: context.l10n.enable_notification_access_sun_title,
buttonValue: state.isNotificationGranted,
onTapRadio: notifier.requestNotificationPermission,
isChecked: state.isNotificationGranted,
onChanged: notifier.requestNotificationPermission,
),
const SizedBox(height: 64),
],
Expand All @@ -112,21 +112,22 @@ class _EnablePermissionViewState extends ConsumerState<EnablePermissionView>
Widget _permissionView({
required String title,
required String subTitle,
required bool buttonValue,
required VoidCallback onTapRadio,
required bool isChecked,
required VoidCallback onChanged,
}) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 24,
height: 24,
child: Radio(
value: true,
groupValue: buttonValue,
child: Checkbox(
value: isChecked,
activeColor: context.colorScheme.primary,
onChanged: (value) {
onTapRadio();
if (value == true) {
onChanged();
}
},
),
),
Expand All @@ -135,8 +136,8 @@ class _EnablePermissionViewState extends ConsumerState<EnablePermissionView>
child: InkWell(
splashColor: Colors.transparent,
onTap: () {
if (!buttonValue) {
onTapRadio();
if (!isChecked) {
onChanged();
}
},
child: Column(
Expand Down

0 comments on commit 853c381

Please sign in to comment.