refactor: deduplicate & other code quality fixes

This commit is contained in:
edde746
2025-11-16 22:42:04 +01:00
parent 0c23de9ede
commit a952ab0a00
28 changed files with 1464 additions and 1927 deletions
+33
View File
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import '../i18n/strings.g.dart';
/// Utility functions for showing common dialogs
/// Shows a delete confirmation dialog
/// Returns true if user confirmed, false if cancelled
Future<bool> showDeleteConfirmation(
BuildContext context, {
required String title,
required String message,
}) async {
final confirmed = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: Text(title),
content: Text(message),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: Text(t.common.cancel),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
style: TextButton.styleFrom(foregroundColor: Colors.red),
child: Text(t.common.delete),
),
],
),
);
return confirmed ?? false;
}