cyberhybridhub/lib/widgets/spelling_question_placeholder.dart
nathanAndrinoid 4459852f83
Some checks failed
Admin portal tests / test (push) Has been cancelled
spelling
2026-06-05 03:22:35 +00:00

66 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import '../theme/app_theme.dart';
/// Shown when spelling is the only enabled source but no spelling question is ready.
class SpellingQuestionPlaceholder extends StatelessWidget {
const SpellingQuestionPlaceholder({
super.key,
this.onRetry,
this.busy = false,
});
final VoidCallback? onRetry;
final bool busy;
@override
Widget build(BuildContext context) {
return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 360),
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.spellcheck,
size: 56,
color: AppColors.accent.withValues(alpha: 0.85),
),
const SizedBox(height: 16),
Text(
'No spelling question ready',
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'Market questions are turned off. Add words in spelling settings '
'or try again to load a spelling quiz.',
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
if (onRetry != null) ...<Widget>[
const SizedBox(height: 20),
FilledButton.icon(
key: const Key('spelling-placeholder-retry'),
onPressed: busy ? null : onRetry,
icon: busy
? const SizedBox(
width: 18,
height: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Icon(Icons.refresh, size: 18),
label: const Text('Try again'),
),
],
],
),
),
),
);
}
}