2022-10-07 18:16:22 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
|
2023-01-04 14:32:58 +01:00
|
|
|
import 'package:adguard_home_manager/widgets/custom_list_tile_dialog.dart';
|
|
|
|
|
2022-10-07 18:16:22 +02:00
|
|
|
class OptionsModal extends StatelessWidget {
|
|
|
|
final void Function() onEdit;
|
|
|
|
final void Function() onDelete;
|
|
|
|
|
|
|
|
const OptionsModal({
|
|
|
|
Key? key,
|
|
|
|
required this.onDelete,
|
|
|
|
required this.onEdit,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AlertDialog(
|
2022-11-04 22:56:00 +01:00
|
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 0,
|
|
|
|
vertical: 16
|
|
|
|
),
|
2022-10-07 18:16:22 +02:00
|
|
|
title: Column(
|
|
|
|
children: [
|
2022-11-05 02:35:35 +01:00
|
|
|
Icon(
|
|
|
|
Icons.more_horiz,
|
|
|
|
color: Theme.of(context).listTileTheme.iconColor
|
|
|
|
),
|
2022-11-04 22:56:00 +01:00
|
|
|
const SizedBox(height: 16),
|
2022-11-05 02:35:35 +01:00
|
|
|
Text(
|
|
|
|
AppLocalizations.of(context)!.options,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).colorScheme.onSurface
|
|
|
|
),
|
|
|
|
)
|
2022-10-07 18:16:22 +02:00
|
|
|
],
|
|
|
|
),
|
2022-11-04 22:56:00 +01:00
|
|
|
content: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
const SizedBox(height: 24),
|
2023-01-04 14:32:58 +01:00
|
|
|
CustomListTileDialog(
|
2022-11-04 22:56:00 +01:00
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
onEdit();
|
|
|
|
},
|
2023-01-04 14:32:58 +01:00
|
|
|
title: AppLocalizations.of(context)!.edit,
|
|
|
|
icon: Icons.edit,
|
2022-11-04 22:56:00 +01:00
|
|
|
),
|
2023-01-04 14:32:58 +01:00
|
|
|
CustomListTileDialog(
|
2022-11-04 22:56:00 +01:00
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
onDelete();
|
|
|
|
},
|
2023-01-04 14:32:58 +01:00
|
|
|
title: AppLocalizations.of(context)!.delete,
|
|
|
|
icon: Icons.delete,
|
2022-11-04 22:56:00 +01:00
|
|
|
),
|
|
|
|
],
|
2022-10-07 18:16:22 +02:00
|
|
|
),
|
|
|
|
actions: [
|
|
|
|
TextButton(
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
child: Text(AppLocalizations.of(context)!.close)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|