fixed a context used across async gap warning and removed comments
This commit is contained in:
@@ -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
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user