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
2 changed files with 26 additions and 81 deletions

View file

@ -1,19 +0,0 @@
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
/// A setting's [title] with the question mark that explains it ([help],
/// halkyon_ui's [HelpButton]) beside it, rather than the explanation always
/// below (the developer's review, 3 Nov 2026).
class const TitleWithHelp(
final String title,
final String help, {
super.key,
}) extends StatelessWidget {
@override
Widget build(BuildContext context) => Row(
children: [
Flexible(child: Text(title)),
HelpButton(help, title: title),
],
);
}

View file

@ -1,7 +1,6 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:halkyon_meditate_flutter/l10n/app_localizations.dart';
import 'package:halkyon_meditate_flutter/src/core/privacy/meditate_keys.dart';
import 'package:halkyon_meditate_flutter/src/core/widget/title_with_help.dart';
import 'package:halkyon_meditate_flutter/src/feature/practice/widget/practice_texts.dart';
import 'package:halkyon_meditate_flutter/src/feature/settings/model/meditate_settings.dart';
import 'package:halkyon_meditate_flutter/src/feature/sitting/bloc/practice_cubit.dart';
@ -68,7 +67,10 @@ class const SittingSettingsCard({super.key}) extends StatelessWidget {
),
SwitchListTile(
secondary: const Icon(LucideIcons.sunMedium),
title: TitleWithHelp(l10n.keepScreenOnTitle, l10n.keepScreenOnHint),
title: ExplainedTitle(
l10n.keepScreenOnTitle,
help: l10n.keepScreenOnHint,
),
value: settings.keepScreenOn,
onChanged: (on) =>
_write(context, settings.copyWith(keepScreenOn: on)),
@ -125,7 +127,10 @@ class const PracticeSettingsCard({super.key}) extends StatelessWidget {
children: [
SwitchListTile(
secondary: const Icon(LucideIcons.flame),
title: TitleWithHelp(l10n.showStreakTitle, l10n.showStreakHint),
title: ExplainedTitle(
l10n.showStreakTitle,
help: l10n.showStreakHint,
),
value: settings.showStreak,
onChanged: (on) => _write(context, settings.copyWith(showStreak: on)),
),
@ -148,7 +153,10 @@ class const JournalSettingsCard({super.key}) extends StatelessWidget {
children: [
SwitchListTile(
secondary: const Icon(LucideIcons.sunrise),
title: TitleWithHelp(l10n.dreamPromptTitle, l10n.dreamPromptHint),
title: ExplainedTitle(
l10n.dreamPromptTitle,
help: l10n.dreamPromptHint,
),
value: settings.dreamPrompt,
onChanged: (on) =>
_write(context, settings.copyWith(dreamPrompt: on)),