fixed a context used across async gap warning and removed comments

This commit is contained in:
asif
2025-08-27 20:34:11 +05:30
parent 9f6b35d3eb
commit f65507a706
3 changed files with 52 additions and 53 deletions

View File

@@ -24,7 +24,6 @@ class AppThemes {
brightness: Brightness.light, // Explicitly set for a light theme
);
// Create the ThemeData from the ColorScheme
return ThemeData.from(
colorScheme: colorScheme,
useMaterial3: true, // Recommended for modern Flutter apps

View File

@@ -16,12 +16,13 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
void _deleteBeneficiary(BuildContext context) async {
try {
await service.deleteBeneficiary(beneficiary.accountNo);
if (!context.mounted) {
return;
}
_showSuccessDialog(context);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'${AppLocalizations.of(context).failedToDeleteBeneficiary}: $e')),
SnackBar(content: Text('Failed to delete beneficiary: $e')),
);
}
}
@@ -31,12 +32,11 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(AppLocalizations.of(context).success),
content:
Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
title: const Text('Success'),
content: const Text('Beneficiary deleted successfully.'),
actions: <Widget>[
TextButton(
child: Text(AppLocalizations.of(context).ok),
child: const Text('OK'),
onPressed: () {
Navigator.of(context).popUntil((route) => route.isFirst);
},
@@ -52,18 +52,18 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(AppLocalizations.of(context).deleteBeneficiary),
content: Text(AppLocalizations.of(context)
.areYouSureYouWantToDeleteThisBeneficiary),
title: const Text('Delete Beneficiary'),
content:
const Text('Are you sure you want to delete this beneficiary?'),
actions: <Widget>[
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: const Text('Cancel'),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text(AppLocalizations.of(context).delete),
child: const Text('Delete'),
onPressed: () {
//Navigator.of(context).pop();
_deleteBeneficiary(context);