mirror of
https://github.com/immich-app/immich.git
synced 2024-12-19 00:32:49 +02:00
4c2befc68c
* 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>
59 lines
1.4 KiB
Dart
59 lines
1.4 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
|
|
|
class ConfirmDialog extends StatelessWidget {
|
|
final Function onOk;
|
|
final String title;
|
|
final String content;
|
|
final String cancel;
|
|
final String ok;
|
|
|
|
const ConfirmDialog({
|
|
Key? key,
|
|
required this.onOk,
|
|
required this.title,
|
|
required this.content,
|
|
this.cancel = "delete_dialog_cancel",
|
|
this.ok = "backup_controller_page_background_battery_info_ok",
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
void onOkPressed() {
|
|
onOk();
|
|
context.pop(true);
|
|
}
|
|
|
|
return AlertDialog(
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
),
|
|
title: Text(title).tr(),
|
|
content: Text(content).tr(),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => context.pop(false),
|
|
child: Text(
|
|
cancel,
|
|
style: TextStyle(
|
|
color: context.primaryColor,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
).tr(),
|
|
),
|
|
TextButton(
|
|
onPressed: onOkPressed,
|
|
child: Text(
|
|
ok,
|
|
style: TextStyle(
|
|
color: Colors.red[400],
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
).tr(),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|