immich/mobile/lib/widgets/common/confirm_dialog.dart
shenlong 675408b003
chore: migrate mobile translations accessor (5) (#30672)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
2026-08-11 14:41:13 +05:30

43 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/generated/translations.g.dart';
class ConfirmDialog extends StatelessWidget {
final Function? onOk;
final String title;
final String content;
final String? cancel;
final String? ok;
const ConfirmDialog({super.key, this.onOk, required this.title, required this.content, this.cancel, this.ok});
@override
Widget build(BuildContext context) {
void onOkPressed() {
onOk?.call();
context.pop(true);
}
return AlertDialog(
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10))),
title: Text(title),
content: Text(content),
actions: [
TextButton(
onPressed: () => context.pop(false),
child: Text(
cancel ?? context.t.cancel,
style: TextStyle(color: context.primaryColor, fontWeight: FontWeight.bold),
),
),
TextButton(
onPressed: onOkPressed,
child: Text(
ok ?? context.t.backup_controller_page_background_battery_info_ok,
style: TextStyle(color: context.colorScheme.error, fontWeight: FontWeight.bold),
),
),
],
);
}
}