Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 43 additions & 37 deletions lib/app/shell_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import 'package:kynos/app/shell_navigation_scope.dart';
import 'package:kynos/core/theme/theme.dart';
import 'package:kynos/features/character/presentation/pages/character_page.dart';
import 'package:kynos/features/training/presentation/pages/training_page.dart';
import 'package:kynos/shared/widgets/kynos_bottom_nav.dart';
import 'package:kynos/shared/widgets/kynos_nav_rail.dart';
import 'package:kynos/shared/widgets/nav_icon.dart';
import 'package:kynos/shared/widgets/responsive_center.dart';

/// Root app shell — floating bottom nav with three focused tabs.
/// Root app shell — left-edge nav rail with three focused tabs.
class ShellPage extends ConsumerWidget {
const ShellPage({super.key, required this.navigationShell});

final StatefulNavigationShell navigationShell;

static const _navItems = [
KynosBottomNavItem(label: 'Coach', icon: NavIconPaths.coach),
KynosBottomNavItem(label: 'Health', icon: NavIconPaths.training),
KynosBottomNavItem(label: 'Journey', icon: NavIconPaths.character),
KynosNavRailItem(label: 'Coach', icon: NavIconPaths.coach),
KynosNavRailItem(label: 'Health', icon: NavIconPaths.training),
KynosNavRailItem(label: 'Journey', icon: NavIconPaths.character),
];

void _onTabSelected(int index) {
Expand All @@ -36,41 +36,47 @@ class ShellPage extends ConsumerWidget {
goToBranch: _onTabSelected,
child: Scaffold(
backgroundColor: kynos.background,
extendBody: true,
body: ResponsiveCenter(
child: Padding(
padding: EdgeInsets.only(
bottom: LayoutTokens.shellNavExtent(context),
),
child: _AnimatedShellBody(
tabIndex: navigationShell.currentIndex,
child: navigationShell,
),
),
),
bottomNavigationBar: Align(
alignment: Alignment.bottomCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: LayoutTokens.maxContentWidth,
body: Stack(
fit: StackFit.expand,
children: [
Positioned(
top: -120,
right: -80,
child: IgnorePointer(
child: Container(
width: 280,
height: 280,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
kynos.purple.withValues(alpha: 0.08),
Colors.transparent,
],
),
),
),
),
),
child: AnimatedSlide(
duration: Motion.fast,
curve: Motion.curve,
offset: MediaQuery.viewInsetsOf(context).bottom > 0
? const Offset(0, 1.4)
: Offset.zero,
child: AnimatedOpacity(
duration: Motion.fast,
opacity: MediaQuery.viewInsetsOf(context).bottom > 0 ? 0 : 1,
child: KynosBottomNav(
Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
KynosNavRail(
items: _navItems,
selectedIndex: navigationShell.currentIndex,
onSelected: _onTabSelected,
),
),
Expanded(
child: ResponsiveCenter(
child: _AnimatedShellBody(
tabIndex: navigationShell.currentIndex,
child: navigationShell,
),
),
),
],
),
),
],
),
),
);
Expand Down Expand Up @@ -106,7 +112,7 @@ class _AnimatedShellBodyState extends State<_AnimatedShellBody>
}

void _buildAnimations() {
final slideOffset = 0.15 * _direction;
final slideOffset = 0.08 * _direction;
final curved = CurvedAnimation(parent: _controller, curve: Motion.curve);
_slide = Tween<Offset>(
begin: Offset(slideOffset, 0),
Expand Down Expand Up @@ -143,7 +149,7 @@ class _AnimatedShellBodyState extends State<_AnimatedShellBody>
}
}

/// Health tab — sleep, recovery, movement, experiments, and activity detail.
/// Health tab — unified health hub (dashboard + training).
class HealthTab extends StatelessWidget {
const HealthTab({super.key});

Expand All @@ -153,7 +159,7 @@ class HealthTab extends StatelessWidget {
}
}

/// Journey tab — sustainable wellbeing progression and the existing camp.
/// Journey tab — sustainable wellbeing progression and camp.
class JourneyTab extends StatelessWidget {
const JourneyTab({super.key});

Expand Down
28 changes: 19 additions & 9 deletions lib/core/theme/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ import 'package:kynos/core/theme/spacing.dart' as tokens;

/// Layout constants for consistent page structure.
abstract final class LayoutTokens {
/// Fixed height of the floating shell nav bar (excludes device safe-area).
static const double shellNavBarHeight =
tokens.Spacing.md + tokens.Spacing.xs + tokens.Spacing.xs * 2 + 56;
/// Width of the left-edge shell navigation rail.
static const double shellRailWidth = 56;

/// Total bottom inset required to clear the floating shell nav bar.
static double shellNavExtent(BuildContext context) =>
shellNavBarHeight + MediaQuery.viewPaddingOf(context).bottom;
/// @deprecated Use [shellRailWidth]. Kept for legacy bottom-nav references.
static const double shellNavBarHeight = shellRailWidth;

/// Bottom scroll padding to clear the floating shell nav bar.
static const double shellBottomPadding =
tokens.Spacing.xxxl * 2 + tokens.Spacing.xl + tokens.Spacing.lg;
/// Total bottom inset — rail layout no longer reserves bottom chrome.
static double shellNavExtent(BuildContext context) => 0;

/// Bottom scroll padding for tab content (safe-area aware).
static double shellBottomPadding(BuildContext context) =>
tokens.Spacing.xxxl +
MediaQuery.viewPaddingOf(context).bottom;

/// @deprecated Prefer [shellBottomPadding] with context for safe-area.
static const double shellBottomPaddingLegacy =
tokens.Spacing.xxxl + tokens.Spacing.lg;

static const double heroBannerHeight =
tokens.Spacing.xxxl * 2 + tokens.Spacing.sm - tokens.Spacing.xs;
Expand All @@ -36,6 +42,10 @@ abstract final class LayoutTokens {
right: tokens.Spacing.md,
);

static const EdgeInsets shellRailPadding = EdgeInsets.only(
left: tokens.Spacing.xs,
);

static const EdgeInsets settingsSectionPadding = EdgeInsets.fromLTRB(
tokens.Spacing.md,
tokens.Spacing.lg,
Expand Down
9 changes: 7 additions & 2 deletions lib/features/character/presentation/pages/character_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:kynos/features/character/presentation/widgets/summit_progress_ca
import 'package:kynos/features/character/presentation/widgets/titles_panel.dart';
import 'package:kynos/features/character/presentation/widgets/wellbeing_quest_panel.dart';
import 'package:kynos/features/character/presentation/widgets/xp_bar.dart';
import 'package:kynos/features/dashboard/presentation/widgets/daily_quest_teaser.dart';
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
import 'package:kynos/shared/providers/camp_providers.dart';
import 'package:kynos/shared/providers/character_providers.dart';
import 'package:kynos/shared/providers/daily_quests_provider.dart';
Expand Down Expand Up @@ -108,11 +109,11 @@ class CharacterPage extends ConsumerWidget {
return const SliverFillRemaining(child: EmptyCharacterState());
}
return SliverPadding(
padding: const EdgeInsets.fromLTRB(
padding: EdgeInsets.fromLTRB(
tokens.Spacing.md,
0,
tokens.Spacing.md,
LayoutTokens.shellBottomPadding,
LayoutTokens.shellBottomPadding(context),
),
sliver: SliverList.list(
children: [
Expand Down Expand Up @@ -162,6 +163,10 @@ class CharacterPage extends ConsumerWidget {
const Gap(tokens.Spacing.md),
XpBar(character: character),
const Gap(tokens.Spacing.lg),
const KynosSectionHeader(title: 'DAILY QUEST'),
const Gap(tokens.Spacing.sm),
DailyQuestTeaser(questsAsync: questsAsync),
const Gap(tokens.Spacing.lg),
const KynosSectionHeader(title: 'STATS'),
const Gap(tokens.Spacing.sm),
StatsPanel(character: character),
Expand Down
92 changes: 44 additions & 48 deletions lib/features/coach_chat/presentation/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:kynos/core/theme/theme.dart';
import 'package:kynos/domain/entities/ai_inference_backend.dart';
import 'package:kynos/domain/entities/chat_message.dart';
import 'package:kynos/domain/entities/health/health_coach_models.dart';
import 'package:kynos/domain/utils/readiness_score.dart';
import 'package:kynos/features/coach_chat/presentation/widgets/animated_message_entrance.dart';
import 'package:kynos/features/coach_chat/presentation/widgets/assistant_bubble.dart';
import 'package:kynos/features/coach_chat/presentation/widgets/daily_health_brief_card.dart';
Expand All @@ -13,6 +14,8 @@ import 'package:kynos/features/coach_chat/presentation/widgets/health_check_in_s
import 'package:kynos/features/coach_chat/providers/coach_chat_provider.dart';
import 'package:kynos/shared/providers/ai_repository_providers.dart';
import 'package:kynos/shared/providers/health_coach_providers.dart';
import 'package:kynos/shared/providers/health_providers.dart';
import 'package:kynos/shared/widgets/kynos_chip.dart';
import 'package:kynos/shared/widgets/kynos_loading_line.dart';
import 'package:kynos/shared/widgets/kynos_user_bubble.dart';

Expand Down Expand Up @@ -168,7 +171,9 @@ class CoachChatEmptyState extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final brief = ref.watch(dailyHealthBriefProvider);
final summary = ref.watch(healthSummaryProvider);
final coachData = ref.watch(healthCoachDataProvider).value;
final kynos = context.kynosTheme;
final now = DateTime.now();
final todayCheckIn = coachData?.checkIns
.where(
Expand All @@ -178,6 +183,11 @@ class CoachChatEmptyState extends ConsumerWidget {
item.date.day == now.day,
)
.firstOrNull;
final readiness = readinessScore(summary.value);
final readinessLine = readiness > 0
? readinessSummaryBrief(readiness).split('.').first
: null;

return ListView(
padding: const EdgeInsets.fromLTRB(
Spacing.md,
Expand All @@ -186,6 +196,13 @@ class CoachChatEmptyState extends ConsumerWidget {
LayoutTokens.chatInputClearance,
),
children: [
if (readinessLine != null) ...[
KynosChip.accent(
label: readinessLine,
color: kynos.purple,
),
const Gap(Spacing.sm),
],
brief.when(
loading: () =>
const KynosLoadingLine(label: 'Building your health brief…'),
Expand Down Expand Up @@ -217,55 +234,34 @@ class CoachChatEmptyState extends ConsumerWidget {
),
),
const Gap(Spacing.xl),
Padding(
padding: const EdgeInsets.symmetric(horizontal: Spacing.sm),
child: Column(
children: [
Container(
width: 52,
height: 52,
decoration: BoxDecoration(
color: context.kynosTheme.purple.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(Radius.lg),
),
child: Icon(
Icons.auto_awesome_rounded,
color: context.kynosTheme.purple,
),
),
const Gap(Spacing.md),
Text(
'What would you like to understand?',
style: Theme.of(context).textTheme.displaySmall,
),
const Gap(Spacing.sm),
Text(
'KYNOS can investigate patterns, build local visualisations, and explain uncertainty.',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyMedium,
),
const Gap(Spacing.lg),
Wrap(
alignment: WrapAlignment.center,
spacing: Spacing.sm,
runSpacing: Spacing.sm,
children:
[
'Why has my energy changed?',
'Show my sleep trend',
'Compare this week with last week',
'What seems to help my wellbeing?',
]
.map(
(suggestion) => GlassSuggestionChip(
label: suggestion,
onTap: () => onSuggestionTap(suggestion),
),
)
.toList(),
Text(
'What would you like to understand?',
style: Theme.of(context).textTheme.titleLarge,
),
const Gap(Spacing.xs),
Text(
'Ask about patterns, trends, or what to do next.',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: kynos.secondaryLabel,
),
],
),
),
const Gap(Spacing.lg),
Wrap(
spacing: Spacing.sm,
runSpacing: Spacing.sm,
children: [
'Why has my energy changed?',
'Show my sleep trend',
'Compare this week with last week',
'What should I do today?',
]
.map(
(suggestion) => GlassSuggestionChip(
label: suggestion,
onTap: () => onSuggestionTap(suggestion),
),
)
.toList(),
),
],
);
Expand Down
4 changes: 2 additions & 2 deletions lib/features/dashboard/presentation/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ class _DashboardPageState extends ConsumerState<DashboardPage> {
onAskCoach: () => _openCoachChat(),
),
SliverPadding(
padding: const EdgeInsets.fromLTRB(
padding: EdgeInsets.fromLTRB(
tokens.Spacing.md,
tokens.Spacing.lg,
tokens.Spacing.md,
LayoutTokens.shellBottomPadding,
LayoutTokens.shellBottomPadding(context),
),
sliver: SliverList.list(
children: [
Expand Down
Loading
Loading