working on themes
This commit is contained in:
@@ -326,11 +326,11 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
content: Text(
|
||||
isCorrect ? 'Correct!' : 'Wrong — correct: $correctDisplay',
|
||||
style: TextStyle(
|
||||
color: isCorrect ? Colors.greenAccent : Colors.redAccent,
|
||||
color: isCorrect ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
backgroundColor: const Color(0xFF222222),
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
duration: const Duration(milliseconds: 900),
|
||||
);
|
||||
if (mounted) {
|
||||
@@ -341,7 +341,11 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
_isAnswering = true; // Disable input after showing result
|
||||
});
|
||||
|
||||
Future.delayed(const Duration(milliseconds: 900), () => _nextQuestion());
|
||||
Future.delayed(const Duration(milliseconds: 900), () {
|
||||
if (mounted) {
|
||||
_nextQuestion();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -353,7 +357,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('WaniKani API key is not set.', style: TextStyle(color: Colors.white)),
|
||||
Text('WaniKani API key is not set.', style: TextStyle(color: Theme.of(context).colorScheme.onSurface)),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
@@ -382,7 +386,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
],
|
||||
),
|
||||
),
|
||||
backgroundColor: const Color(0xFF121212),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
@@ -426,11 +430,11 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
Expanded(
|
||||
child: Text(
|
||||
_status,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
),
|
||||
if (_loading)
|
||||
const CircularProgressIndicator(color: Colors.blueAccent),
|
||||
CircularProgressIndicator(color: Theme.of(context).colorScheme.primary),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
@@ -446,8 +450,8 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
child: KanjiCard(
|
||||
characters: prompt,
|
||||
subtitle: subtitle,
|
||||
backgroundColor: const Color(0xFF1E1E1E),
|
||||
textColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
textColor: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -468,7 +472,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Score: ${quizState.score} / ${quizState.asked}',
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -28,8 +28,8 @@ class StartScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFF121212),
|
||||
Colors.grey[900]!,
|
||||
Theme.of(context).colorScheme.surface,
|
||||
Theme.of(context).colorScheme.surface,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -113,14 +113,18 @@ class StartScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
description,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
softWrap: true,
|
||||
),
|
||||
|
||||
@@ -40,9 +40,9 @@ class OptionsGrid extends StatelessWidget {
|
||||
|
||||
if (showResult) {
|
||||
if (correctAnswers != null && correctAnswers!.contains(o)) {
|
||||
currentButtonColor = Colors.green;
|
||||
currentButtonColor = theme.colorScheme.tertiary;
|
||||
} else if (o == selectedOption) {
|
||||
currentButtonColor = Colors.red;
|
||||
currentButtonColor = theme.colorScheme.error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class OptionsGrid extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
o,
|
||||
style: TextStyle(fontSize: 20, color: currentTextColor),
|
||||
style: theme.textTheme.titleMedium?.copyWith(color: currentTextColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user