fix(study): the explanation has an open book, the hints the light bulb
Both pills showed a light bulb. The explanation's now has the open book that Add explanation has in the composer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
c002a07011
commit
e6580e7812
2 changed files with 18 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ class const HintsButton({required final List<RichContent> hints, super.key})
|
|||
Widget build(BuildContext context) => hints.isEmpty
|
||||
? const SizedBox.shrink()
|
||||
: _Pill(
|
||||
icon: LucideIcons.lightbulb,
|
||||
label: AppLocalizations.of(context).cardHints,
|
||||
onPressed: () => showAdaptiveSheet<void>(
|
||||
context,
|
||||
|
|
@ -20,7 +21,9 @@ class const HintsButton({required final List<RichContent> hints, super.key})
|
|||
);
|
||||
}
|
||||
|
||||
/// A card's [explanation] as a pill to open it; nothing without.
|
||||
/// A card's [explanation] as a pill to open it; nothing without. An open
|
||||
/// book, as Add explanation has in the composer, tells it from the hints'
|
||||
/// light bulb.
|
||||
class const ExplanationButton({
|
||||
required final RichContent? explanation,
|
||||
super.key,
|
||||
|
|
@ -30,6 +33,7 @@ class const ExplanationButton({
|
|||
final l10n = AppLocalizations.of(context);
|
||||
return switch (explanation) {
|
||||
final explanation? => _Pill(
|
||||
icon: LucideIcons.bookOpen,
|
||||
label: l10n.cardExplanation,
|
||||
onPressed: () => showAdaptiveSheet<void>(
|
||||
context,
|
||||
|
|
@ -44,8 +48,9 @@ class const ExplanationButton({
|
|||
}
|
||||
}
|
||||
|
||||
/// A light bulb and [label] on an outlined pill, in muted colours.
|
||||
/// [icon] and [label] on an outlined pill, in muted colours.
|
||||
class const _Pill({
|
||||
required final IconData icon,
|
||||
required final String label,
|
||||
required final VoidCallback onPressed,
|
||||
}) extends StatelessWidget {
|
||||
|
|
@ -54,7 +59,7 @@ class const _Pill({
|
|||
final colors = Theme.of(context).colorScheme;
|
||||
return OutlinedButton.icon(
|
||||
onPressed: onPressed,
|
||||
icon: const Icon(LucideIcons.lightbulb, size: 16),
|
||||
icon: Icon(icon, size: 16),
|
||||
label: Text(label),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: colors.onSurfaceVariant,
|
||||
|
|
|
|||
|
|
@ -304,7 +304,8 @@ void main() {
|
|||
});
|
||||
|
||||
testWidgets('hints open from under the question, one at a time; the '
|
||||
'explanation comes with the answer', (tester) async {
|
||||
"explanation comes with the answer, an open book to the hints' light "
|
||||
'bulb', (tester) async {
|
||||
await cards.create(
|
||||
'japanese',
|
||||
CardContent(
|
||||
|
|
@ -330,6 +331,14 @@ void main() {
|
|||
|
||||
await tester.tap(find.text('Show answer'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.widgetWithIcon(OutlinedButton, LucideIcons.lightbulb),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.widgetWithIcon(OutlinedButton, LucideIcons.bookOpen),
|
||||
findsOneWidget,
|
||||
);
|
||||
await tester.tap(find.text('Explanation'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
|
|
|
|||
Loading…
Reference in a new issue