feat(learn,app): explanations wait behind a question mark beside their title

What explains a setting or a section, rather than what is the person's
own, moves behind halkyon_ui's HelpButton, beside its title through the
new ExplainedTitle (the developer's review of 3 Nov 2026): in Learn's
settings (citations, the Pomodoro timer, grammar, the web search,
Jellyfin, the device's dictionaries, counting one's learning), the study
settings, export's progress, the Jellyfin tags and the study button's
back first; in halkyon_app, setting up a password, adding SimpleLogin,
own keys not allowed, the profile page's link back and the operator's
grant sheet.

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 22:24:39 +01:00
commit 830aea10fe
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
3 changed files with 279 additions and 115 deletions

View file

@ -22,6 +22,7 @@ export 'src/widget/confirm_dialog.dart';
export 'src/widget/count_badge.dart';
export 'src/widget/count_stepper.dart';
export 'src/widget/empty_list_message.dart';
export 'src/widget/explained_title.dart';
export 'src/widget/field_label.dart';
export 'src/widget/floating_navigation_bar.dart';
export 'src/widget/folding_tabs.dart';

View file

@ -0,0 +1,22 @@
import 'package:halkyon_ui/src/widget/help_button.dart';
import 'package:material_ui/material_ui.dart';
/// A section's or a setting's [title] with its [HelpButton] right beside
/// it, opening [help] under the title (decided 3 Nov 2026: what explains
/// is one tap away). In [style] where given, the surrounding text's
/// otherwise, as a [ListTile]'s title; a long title wraps, the question
/// mark kept beside its end.
class const ExplainedTitle(
final String title, {
required final String help,
final TextStyle? style,
super.key,
}) extends StatelessWidget {
@override
Widget build(BuildContext context) => Row(
children: [
Flexible(child: Text(title, style: style)),
HelpButton(help, title: title),
],
);
}

View file

@ -0,0 +1,52 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
import '../support/test_app.dart';
void main() {
testWidgets('a title with its question mark right beside it, the '
'explanation opening under the title', (tester) async {
await tester.pumpWidget(
testApp(
const Scaffold(
body: SizedBox(
width: 300,
child: ListTile(
title: ExplainedTitle(
'Check spelling',
help: 'Underlines possible mistakes.',
),
),
),
),
),
);
expect(find.text('Underlines possible mistakes.'), findsNothing);
final title = tester.getRect(find.text('Check spelling'));
final help = tester.getRect(find.byType(HelpButton));
expect(help.left - title.right, lessThan(8), reason: 'beside it');
await tester.tap(find.byType(HelpButton));
await tester.pumpAndSettle();
expect(find.text('Check spelling'), findsNWidgets(2));
expect(find.text('Underlines possible mistakes.'), findsOneWidget);
});
testWidgets('a long title wraps, its question mark kept', (
tester,
) async {
await tester.pumpWidget(
testApp(
Scaffold(
body: SizedBox(
width: 200,
child: ExplainedTitle('A title ' * 20, help: 'Why.'),
),
),
),
);
expect(tester.takeException(), isNull);
expect(find.byType(HelpButton), findsOneWidget);
});
}