refactor(todo,meditate,train): a title with its question mark is halkyon_ui's ExplainedTitle

Three forks of the 3 Nov review each wrote the same widget (Todo's and
Meditate's TitleWithHelp, Train's HelpTitle); halkyon_ui's ExplainedTitle,
from Learn's, takes their place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 23:18:11 +01:00
commit 9dcb0dbdc3
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,44 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
void main() {
testWidgets("a setting's title keeps its explanation behind the question "
'mark, and a tap on the title still reaches the tile', (tester) async {
var on = false;
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: HalkyonUiLocalizations.localizationsDelegates,
home: Scaffold(
body: StatefulBuilder(
builder: (context, setState) => SwitchListTile(
title: const ExplainedTitle(
'Smaller copies',
help: 'Lossless files kept as Opus.',
),
value: on,
onChanged: (value) => setState(() => on = value),
),
),
),
),
);
expect(find.text('Lossless files kept as Opus.'), findsNothing);
await tester.tap(find.text('Smaller copies'));
await tester.pump();
expect(on, isTrue);
await tester.tap(find.byType(HelpButton));
await tester.pumpAndSettle();
expect(find.text('Lossless files kept as Opus.'), findsOneWidget);
expect(
find.descendant(
of: find.byType(AlertDialog),
matching: find.text('Smaller copies'),
),
findsOneWidget,
);
expect(on, isTrue, reason: 'the question mark leaves the switch alone');
});
}