cleanup code a bit

This commit is contained in:
Rene Kievits
2025-10-28 01:59:41 +01:00
parent ab86f015c1
commit 59fde3457d
9 changed files with 62 additions and 56 deletions

View File

@@ -102,7 +102,7 @@ class _HomeScreenState extends State<HomeScreen> {
final pickedType = choices[_random.nextInt(choices.length)];
final readingsList = pickedType == 'onyomi' ? item.onyomi : item.kunyomi;
final hint = 'Select the ${pickedType == 'onyomi' ? "on\'yomi" : "kunyomi"}';
final hint = 'Select the ${pickedType == 'onyomi' ? "on'yomi" : "kunyomi"}';
return _ReadingInfo(readingsList, hint);
}

View File

@@ -26,11 +26,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
final repo = Provider.of<DeckRepository>(context, listen: false);
await repo.setApiKey(apiKey);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('API key saved!')),
);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('API key saved!')),
);
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => const HomeScreen()),
);