import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Scaffold( body: DecoratedBox( decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [Color(0xFFF3EDE0), Color(0xFFE9E0CF), Color(0xFFDDE8E0)], ), ), child: SafeArea( child: ListView( padding: const EdgeInsets.fromLTRB(20, 16, 20, 24), children: [ Text( 'TC Mobile Lab', style: theme.textTheme.titleMedium?.copyWith( color: theme.colorScheme.primary, letterSpacing: 0.6, ), ), const SizedBox(height: 10), Text( 'Audio tricorder for structured signal analysis.', style: theme.textTheme.displaySmall, ), const SizedBox(height: 12), Text( 'Record a sample, let the probe chain inspect it, then hand the evidence to the AI analyst for hypothesis, validation, and conclusion.', style: theme.textTheme.bodyLarge, ), const SizedBox(height: 24), Card( child: Padding( padding: const EdgeInsets.all(22), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Quick Start', style: theme.textTheme.headlineMedium, ), const SizedBox(height: 12), _SignalChip( label: 'Local probe chain', tone: theme.colorScheme.secondary, ), const SizedBox(height: 10), _SignalChip( label: 'Remote AI analyst', tone: theme.colorScheme.tertiary, ), const SizedBox(height: 18), Row( children: [ Expanded( child: FilledButton( onPressed: () => context.goNamed('capture'), child: const Text('Start Recording'), ), ), const SizedBox(width: 12), Expanded( child: OutlinedButton( onPressed: () => context.goNamed('observation'), child: const Text('Import Sample'), ), ), ], ), ], ), ), ), const SizedBox(height: 18), Row( children: [ Expanded( child: _StatusCard( title: 'Current Mode', value: 'Idle', note: 'Ready for local probe', accent: theme.colorScheme.primary, ), ), const SizedBox(width: 14), Expanded( child: _StatusCard( title: 'Pipeline', value: 'Probe', note: 'No active experiment', accent: theme.colorScheme.secondary, ), ), ], ), const SizedBox(height: 18), Card( child: Padding( padding: const EdgeInsets.all(22), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Lab Sections', style: theme.textTheme.titleLarge), const SizedBox(height: 14), Wrap( spacing: 10, runSpacing: 10, children: [ _NavChip( label: 'Observation', onTap: () => context.goNamed('observation'), ), _NavChip( label: 'Experiment', onTap: () => context.goNamed('experiment'), ), _NavChip( label: 'Conclusion', onTap: () => context.goNamed('conclusion'), ), _NavChip( label: 'History', onTap: () => context.goNamed('history'), ), _NavChip( label: 'Settings', onTap: () => context.goNamed('settings'), ), ], ), ], ), ), ), const SizedBox(height: 18), Card( child: Padding( padding: const EdgeInsets.all(22), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('First MVP flow', style: theme.textTheme.titleLarge), const SizedBox(height: 16), const _FlowStep( index: '01', title: 'Capture Observation', body: 'Record or import audio and store the observation metadata.', ), const _FlowStep( index: '02', title: 'Run Probe Chain', body: 'Generate onset, spectral, and periodicity evidence on device.', ), const _FlowStep( index: '03', title: 'Ask AI Analyst', body: 'Send structured evidence for hypothesis and experiment planning.', ), const _FlowStep( index: '04', title: 'Review Conclusion', body: 'Inspect findings, contradictions, and next-step suggestions.', ), ], ), ), ), ], ), ), ), ); } } class _NavChip extends StatelessWidget { const _NavChip({required this.label, required this.onTap}); final String label; final VoidCallback onTap; @override Widget build(BuildContext context) { return ActionChip( label: Text(label), onPressed: onTap, avatar: const Icon(Icons.arrow_outward, size: 18), ); } } class _StatusCard extends StatelessWidget { const _StatusCard({ required this.title, required this.value, required this.note, required this.accent, }); final String title; final String value; final String note; final Color accent; @override Widget build(BuildContext context) { final theme = Theme.of(context); return Card( child: Padding( padding: const EdgeInsets.all(18), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 14, height: 14, decoration: BoxDecoration( color: accent, borderRadius: BorderRadius.circular(999), ), ), const SizedBox(height: 12), Text(title, style: theme.textTheme.titleMedium), const SizedBox(height: 6), Text(value, style: theme.textTheme.headlineMedium), const SizedBox(height: 6), Text(note, style: theme.textTheme.bodyMedium), ], ), ), ); } } class _SignalChip extends StatelessWidget { const _SignalChip({required this.label, required this.tone}); final String label; final Color tone; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( color: tone.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(999), ), child: Text( label, style: Theme.of(context).textTheme.titleMedium?.copyWith(color: tone), ), ); } } class _FlowStep extends StatelessWidget { const _FlowStep({ required this.index, required this.title, required this.body, }); final String index; final String title; final String body; @override Widget build(BuildContext context) { final theme = Theme.of(context); return Padding( padding: const EdgeInsets.only(bottom: 16), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 44, height: 44, alignment: Alignment.center, decoration: BoxDecoration( color: theme.colorScheme.primary, borderRadius: BorderRadius.circular(16), ), child: Text( index, style: theme.textTheme.titleMedium?.copyWith(color: Colors.white), ), ), const SizedBox(width: 14), Expanded( child: Padding( padding: const EdgeInsets.only(top: 2), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(title, style: theme.textTheme.titleMedium), const SizedBox(height: 4), Text(body, style: theme.textTheme.bodyMedium), ], ), ), ), ], ), ); } }