in stateful builder use context instead of outside context (#1229)

This commit is contained in:
ggurdin 2024-12-12 13:19:03 -05:00 committed by GitHub
parent 9444aecfd3
commit cef67731f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -13,9 +13,9 @@ class LanguageController {
_pangeaController = pangeaController;
}
//show diloag when user does not have languages selected
showDialogOnEmptyLanguage(BuildContext dialogContext, Function callback) {
showDialogOnEmptyLanguage(BuildContext context, Function callback) {
if (!languagesSet) {
pLanguageDialog(dialogContext, callback);
pLanguageDialog(context, callback);
}
}

View file

@ -49,14 +49,14 @@ Future<void> pLanguageDialog(
return Scaffold(
backgroundColor: Colors.transparent,
body: AlertDialog(
title: Text(L10n.of(parentContext).updateLanguage),
title: Text(L10n.of(context).updateLanguage),
content: SizedBox(
width: FluffyThemes.columnWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
PQuestionContainer(
title: L10n.of(parentContext).whatIsYourBaseLanguage,
title: L10n.of(context).whatIsYourBaseLanguage,
),
PLanguageDropdown(
onChange: (p0) =>
@ -66,7 +66,7 @@ Future<void> pLanguageDialog(
isL2List: false,
),
PQuestionContainer(
title: L10n.of(parentContext).whatLanguageYouWantToLearn,
title: L10n.of(context).whatLanguageYouWantToLearn,
),
PLanguageDropdown(
onChange: (p0) =>
@ -80,7 +80,7 @@ Future<void> pLanguageDialog(
),
actions: [
TextButton(
child: Text(L10n.of(parentContext).cancel),
child: Text(L10n.of(context).cancel),
onPressed: () {
Navigator.pop(context);
},
@ -117,14 +117,14 @@ Future<void> pLanguageDialog(
: ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
L10n.of(parentContext).noIdenticalLanguages,
L10n.of(context).noIdenticalLanguages,
),
backgroundColor:
Theme.of(context).colorScheme.primary,
),
);
},
child: Text(L10n.of(parentContext).saveChanges),
child: Text(L10n.of(context).saveChanges),
),
],
),