feat(mobile): separate delete buttons (#4505)

* feat(mobile): delete assets from device only

* mobile: add backed up only toggle for delete device only

* remove toggle inside alert and show different content

* mobile: change content color for local only

* mobile: delete local only button to dialog

* style: display bottom action in two lines

* feat: separate delete buttons

* fix: incorrect error message for ownedRemoteSelection

* fix: handle remoteOnly from delete everywhere

* request confirmation for local only only when non-backed assets are in selection

---------

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
shenlong
2024-01-17 03:28:23 +00:00
committed by GitHub
parent 78de4f1312
commit 4c2befc68c
7 changed files with 328 additions and 54 deletions

View File

@@ -1,9 +1,8 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
class ConfirmDialog extends ConsumerWidget {
class ConfirmDialog extends StatelessWidget {
final Function onOk;
final String title;
final String content;
@@ -20,9 +19,16 @@ class ConfirmDialog extends ConsumerWidget {
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Widget build(BuildContext context) {
void onOkPressed() {
onOk();
context.pop(true);
}
return AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
title: Text(title).tr(),
content: Text(content).tr(),
actions: [
@@ -37,10 +43,7 @@ class ConfirmDialog extends ConsumerWidget {
).tr(),
),
TextButton(
onPressed: () {
onOk();
context.pop(true);
},
onPressed: onOkPressed,
child: Text(
ok,
style: TextStyle(