some cleanup and some fixes
This commit is contained in:
@@ -200,14 +200,13 @@ class _BrowseScreenState extends State<BrowseScreen>
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
height: 60,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: List.generate(levels.length, (index) {
|
||||
final level = levels[index];
|
||||
final isSelected = index == currentPage;
|
||||
return Padding(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: List.generate(levels.length, (index) {
|
||||
final level = levels[index];
|
||||
final isSelected = index == currentPage;
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
@@ -222,14 +221,14 @@ class _BrowseScreenState extends State<BrowseScreen>
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||
shape: const CircleBorder(),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
padding: const EdgeInsets.all(12),
|
||||
),
|
||||
child: Text(level.toString()),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -882,11 +881,10 @@ class _VocabDetailsDialogState extends State<_VocabDetailsDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchExampleSentences();
|
||||
_fetchExampleSentences(context);
|
||||
}
|
||||
|
||||
Future<void> _fetchExampleSentences() async {
|
||||
final theme = Theme.of(context);
|
||||
Future<void> _fetchExampleSentences(BuildContext context) async {
|
||||
try {
|
||||
final uri = Uri.parse(
|
||||
'https://jisho.org/api/v1/search/words?keyword=${Uri.encodeComponent(widget.vocab.characters)}',
|
||||
@@ -913,11 +911,11 @@ class _VocabDetailsDialogState extends State<_VocabDetailsDialog> {
|
||||
children: [
|
||||
Text(
|
||||
japaneseWord,
|
||||
style: TextStyle(color: theme.colorScheme.onSurface),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
Text(
|
||||
englishDefinition,
|
||||
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
@@ -931,7 +929,7 @@ class _VocabDetailsDialogState extends State<_VocabDetailsDialog> {
|
||||
sentences.add(
|
||||
Text(
|
||||
'No example sentences found.',
|
||||
style: TextStyle(color: theme.colorScheme.onSurface),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -946,7 +944,7 @@ class _VocabDetailsDialogState extends State<_VocabDetailsDialog> {
|
||||
_exampleSentences = [
|
||||
Text(
|
||||
'Failed to load example sentences.',
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
];
|
||||
});
|
||||
@@ -958,7 +956,7 @@ class _VocabDetailsDialogState extends State<_VocabDetailsDialog> {
|
||||
_exampleSentences = [
|
||||
Text(
|
||||
'Error loading example sentences.',
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user