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