feat(app): one Profile for every app, the person's own tab first, then each app's (ADR 0014)
The public profile was already one per person for every service of an instance (the register, ADR 0016); its app side was Learn's alone. It moves into halkyon_app: the model, the repository on the module's endpoints, the form, the avatar drawn on the device and the sheet with someone's profile. They take the Public prefix (PublicProfileRepository, BasePublicProfileGateway), as Train's own ProfileRepository holds the body's figures. AppDependencies gains profiles and files, the picker the avatar is chosen with, which moves out of Learn too. HalkyonProfile is every app's Profile screen: the person's own tab first, the same in every app (the account and the ways they sign in, the app's own cards, then the public profile), then the app's own tabs, folding into the title. Learn adds its inbox and Statistics. Train adds Progress, Days and, where nothing records, Plans, and so opens on the person's tab, no longer on Progress. Todo, which has no Profile tab, opens it from a row at the top of Browse, where Todoist keeps the account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
a0bb75f1ad
commit
b7b0b937fe
1 changed files with 1668 additions and 1293 deletions
142
packages/halkyon_app/lib/src/profile/widget/halkyon_profile.dart
Normal file
142
packages/halkyon_app/lib/src/profile/widget/halkyon_profile.dart
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:halkyon_app/l10n/halkyon_app_localizations.dart';
|
||||
import 'package:halkyon_app/src/app/app_scope.dart';
|
||||
import 'package:halkyon_app/src/auth/bloc/sign_in_ways_cubit.dart';
|
||||
import 'package:halkyon_app/src/password/widget/account_security_section.dart';
|
||||
import 'package:halkyon_app/src/profile/widget/public_profile_section.dart';
|
||||
import 'package:halkyon_app/src/simplelogin/widget/simplelogin_section.dart';
|
||||
import 'package:halkyon_ui/halkyon_ui.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
/// Every Halkyon app's Profile (decided 2026-11-02, the developer's wish
|
||||
/// for one profile in function and look across the apps): the person's
|
||||
/// own tab first, the same in every app (their account and the ways they
|
||||
/// sign in, SimpleLogin and the password with its authenticators, then the
|
||||
/// app's own [sections], then the public profile others see, one for all
|
||||
/// apps), and after it the app's own [tabs] (Learn's statistics, Train's
|
||||
/// progress). With several tabs, the tab row folds into the title as the
|
||||
/// content scrolls ([FoldingTabs], as Strava's); with none of the app's,
|
||||
/// the person's tab alone, under the title. The [actions] stand in the app
|
||||
/// bar (the app's Settings); the app's colour washes down from the top
|
||||
/// ([TopGradient], [color], into [background]).
|
||||
class const HalkyonProfile({
|
||||
final List<Widget> actions = const [],
|
||||
final List<Widget> sections = const [],
|
||||
final List<FoldingTab> tabs = const [],
|
||||
final Color? color,
|
||||
final Color? background,
|
||||
super.key,
|
||||
}) extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = HalkyonAppLocalizations.of(context);
|
||||
final mine = _Mine(sections: sections);
|
||||
return BlocProvider(
|
||||
create: (context) => SignInWaysCubit(AppScope.of(context).auth)..load(),
|
||||
child: TopGradient(
|
||||
color: color,
|
||||
background: background ?? Theme.of(context).colorScheme.surface,
|
||||
child: tabs.isEmpty
|
||||
? Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
systemOverlayStyle: TopGradient.overlayStyle(context),
|
||||
title: Text(l10n.profileTitle),
|
||||
actions: actions,
|
||||
),
|
||||
body: mine,
|
||||
)
|
||||
: FoldingTabs(
|
||||
title: l10n.profileTitle,
|
||||
actions: actions,
|
||||
tabs: [
|
||||
FoldingTab(label: l10n.profileTabProfile, body: mine),
|
||||
...tabs,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The person's own tab: a card for each part, as Settings groups its own,
|
||||
/// in the middle and as wide as readable text.
|
||||
class const _Mine({required final List<Widget> sections})
|
||||
extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = HalkyonAppLocalizations.of(context);
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: readableContentMaxWidth),
|
||||
child: ListView(
|
||||
// Room at the end for the navigation bar floating over the foot.
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12 +
|
||||
FloatingNavigationBar.coverOf(context) +
|
||||
MediaQuery.paddingOf(context).bottom,
|
||||
),
|
||||
children: [
|
||||
SectionCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
l10n.profileAccount,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(l10n.profileIdentified),
|
||||
const _SignInWays(),
|
||||
],
|
||||
),
|
||||
),
|
||||
for (final section in sections) ...[
|
||||
const SizedBox(height: 12),
|
||||
SectionCard(child: section),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
const SectionCard(child: PublicProfileSection()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// How the person signs in: an email address, and SimpleLogin (Halkyon
|
||||
/// Learn's ADR 0020, D21), with the password and authenticators beneath.
|
||||
class const _SignInWays() extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = HalkyonAppLocalizations.of(context);
|
||||
final theme = Theme.of(context);
|
||||
final ways = context.watch<SignInWaysCubit>().state;
|
||||
Widget way(String label, String linkedAs) => ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(label),
|
||||
subtitle: Text(linkedAs, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
trailing: Icon(LucideIcons.circleCheck, color: theme.colorScheme.primary),
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Text(l10n.profileSignInWays, style: theme.textTheme.titleSmall),
|
||||
if (ways.ways.email)
|
||||
way(l10n.profileWayEmail, ways.emailAddress ?? l10n.profileWayLinked),
|
||||
// SimpleLogin (ADR 0020, D21): once added, one more way in here.
|
||||
const SimpleLoginSection(gapAbove: 16),
|
||||
const SizedBox(height: 16),
|
||||
// The password and authenticators, and setting them up (ADR 0017),
|
||||
// which brings the address.
|
||||
const AccountSecuritySection(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue