mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-08 17:11:14 +00:00
refactor: Fix callbacks returning sets
This commit is contained in:
parent
02870c3149
commit
725c592086
|
@ -335,13 +335,12 @@ class BackupDetailsPage extends StatelessWidget {
|
|||
'backup.forget_snapshot_alert'.tr(),
|
||||
actionButtonTitle:
|
||||
'backup.forget_snapshot'.tr(),
|
||||
actionButtonOnPressed: () => {
|
||||
context.read<BackupsBloc>().add(
|
||||
ForgetSnapshot(
|
||||
backup.id,
|
||||
actionButtonOnPressed: () =>
|
||||
context.read<BackupsBloc>().add(
|
||||
ForgetSnapshot(
|
||||
backup.id,
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
);
|
||||
},
|
||||
title: Text(
|
||||
|
@ -416,11 +415,9 @@ class BackupDetailsPage extends StatelessWidget {
|
|||
),
|
||||
onTap: preventActions
|
||||
? null
|
||||
: () => {
|
||||
context
|
||||
.read<BackupsBloc>()
|
||||
.add(const ForceSnapshotListUpdate()),
|
||||
},
|
||||
: () => context
|
||||
.read<BackupsBloc>()
|
||||
.add(const ForceSnapshotListUpdate()),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(),
|
||||
|
@ -444,7 +441,7 @@ class BackupDetailsPage extends StatelessWidget {
|
|||
),
|
||||
// onTap: preventActions
|
||||
// ? null
|
||||
// : () => {context.read<BackupsCubit>().reuploadKey()},
|
||||
// : () => context.read<BackupsCubit>().reuploadKey(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -75,11 +75,9 @@ class BackupsListPage extends StatelessWidget {
|
|||
alertTitle: 'backup.forget_snapshot'.tr(),
|
||||
description: 'backup.forget_snapshot_alert'.tr(),
|
||||
actionButtonTitle: 'backup.forget_snapshot'.tr(),
|
||||
actionButtonOnPressed: () => {
|
||||
context
|
||||
.read<BackupsBloc>()
|
||||
.add(ForgetSnapshot(backup.id)),
|
||||
},
|
||||
actionButtonOnPressed: () => context
|
||||
.read<BackupsBloc>()
|
||||
.add(ForgetSnapshot(backup.id)),
|
||||
);
|
||||
},
|
||||
title: Text(
|
||||
|
|
|
@ -80,9 +80,8 @@ class _ServicePageState extends State<ServicePage> {
|
|||
const SizedBox(height: 8),
|
||||
ListTile(
|
||||
iconColor: Theme.of(context).colorScheme.onBackground,
|
||||
onTap: () => {
|
||||
context.read<ServicesBloc>().add(ServiceRestart(service)),
|
||||
},
|
||||
onTap: () =>
|
||||
context.read<ServicesBloc>().add(ServiceRestart(service)),
|
||||
leading: const Icon(Icons.restart_alt_outlined),
|
||||
title: Text(
|
||||
'service_page.restart'.tr(),
|
||||
|
@ -92,14 +91,12 @@ class _ServicePageState extends State<ServicePage> {
|
|||
),
|
||||
ListTile(
|
||||
iconColor: Theme.of(context).colorScheme.onBackground,
|
||||
onTap: () => {
|
||||
context.read<JobsCubit>().addJob(
|
||||
ServiceToggleJob(
|
||||
service: service,
|
||||
needToTurnOn: serviceDisabled,
|
||||
),
|
||||
onTap: () => context.read<JobsCubit>().addJob(
|
||||
ServiceToggleJob(
|
||||
service: service,
|
||||
needToTurnOn: serviceDisabled,
|
||||
),
|
||||
},
|
||||
),
|
||||
leading: const Icon(Icons.power_settings_new),
|
||||
title: Text(
|
||||
serviceDisabled
|
||||
|
|
|
@ -51,10 +51,7 @@ class _ServicesPageState extends State<ServicesPage> {
|
|||
iconData: BrandIcons.box,
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
// Create a ServicesRelaod event and wait for the state to change.
|
||||
await context.read<ServicesBloc>().awaitReload();
|
||||
},
|
||||
onRefresh: context.read<ServicesBloc>().awaitReload,
|
||||
child: ListView(
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
|
|
|
@ -46,17 +46,15 @@ class UserDetailsPage extends StatelessWidget {
|
|||
const SizedBox(height: 8),
|
||||
ListTile(
|
||||
iconColor: Theme.of(context).colorScheme.onBackground,
|
||||
onTap: () => {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useRootNavigator: true,
|
||||
builder: (final BuildContext context) => Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: ResetPassword(user: user),
|
||||
),
|
||||
onTap: () => showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useRootNavigator: true,
|
||||
builder: (final BuildContext context) => Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: ResetPassword(user: user),
|
||||
),
|
||||
},
|
||||
),
|
||||
leading: const Icon(Icons.lock_reset_outlined),
|
||||
title: Text(
|
||||
'users.reset_password'.tr(),
|
||||
|
@ -87,45 +85,43 @@ class _DeleteUserTile extends StatelessWidget {
|
|||
Widget build(final BuildContext context) => ListTile(
|
||||
iconColor: Theme.of(context).colorScheme.error,
|
||||
textColor: Theme.of(context).colorScheme.error,
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
// useRootNavigator: false,
|
||||
builder: (final BuildContext context) => AlertDialog(
|
||||
title: Text('basis.confirmation'.tr()),
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'users.delete_confirm_question'.tr(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('basis.cancel'.tr()),
|
||||
onPressed: () {
|
||||
context.router.pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
'basis.delete'.tr(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
// useRootNavigator: false,
|
||||
builder: (final BuildContext context) => AlertDialog(
|
||||
title: Text('basis.confirmation'.tr()),
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'users.delete_confirm_question'.tr(),
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<JobsCubit>().addJob(DeleteUserJob(user: user));
|
||||
context.router.childControllers.first.pop();
|
||||
context.router.pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('basis.cancel'.tr()),
|
||||
onPressed: () {
|
||||
context.router.pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
'basis.delete'.tr(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<JobsCubit>().addJob(DeleteUserJob(user: user));
|
||||
context.router.childControllers.first.pop();
|
||||
context.router.pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
},
|
||||
),
|
||||
leading: const Icon(Icons.person_remove_outlined),
|
||||
title: Text(
|
||||
'users.delete_user'.tr(),
|
||||
|
|
Loading…
Reference in a new issue