| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- import 'package:flutter/material.dart';
- import 'package:flutter_riverpod/flutter_riverpod.dart';
- import '../../../../services/analysis_providers.dart';
- import '../../../shared/presentation/widgets/async_value_view.dart';
- import '../../../shared/presentation/widgets/lab_section_scaffold.dart';
- class ConclusionPage extends ConsumerWidget {
- const ConclusionPage({super.key});
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final theme = Theme.of(context);
- final snapshot = ref.watch(selectedSessionSnapshotProvider);
- return LabSectionScaffold(
- eyebrow: 'Conclusion',
- title: 'Review the evidence-backed result.',
- description:
- 'This page presents ranked findings, supporting evidence, contradicting evidence, uncertainty, and next-step suggestions from the AI analyst.',
- children: [
- AsyncValueView(
- value: snapshot,
- loadingMessage: 'Loading conclusion...',
- data: (session) {
- if (session == null) {
- return const Card(
- child: Padding(
- padding: EdgeInsets.all(20),
- child: Text('No session selected yet.'),
- ),
- );
- }
- final conclusion = session.conclusion;
- return Column(
- children: [
- Card(
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('Summary', style: theme.textTheme.titleLarge),
- const SizedBox(height: 8),
- Text(
- conclusion.summary,
- style: theme.textTheme.bodyLarge,
- ),
- ],
- ),
- ),
- ),
- const SizedBox(height: 16),
- Card(
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Leading Hypotheses',
- style: theme.textTheme.titleLarge,
- ),
- const SizedBox(height: 12),
- ...session.hypotheses.map(
- (hypothesis) => ListTile(
- contentPadding: EdgeInsets.zero,
- title: Text(hypothesis.label),
- subtitle: Text(hypothesis.rationale),
- trailing: Text(
- hypothesis.confidence.toStringAsFixed(2),
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- const SizedBox(height: 16),
- Card(
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('Findings', style: theme.textTheme.titleLarge),
- const SizedBox(height: 12),
- ...conclusion.findings.map(
- (finding) => Padding(
- padding: const EdgeInsets.only(bottom: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '${finding.label} | ${finding.confidence.toStringAsFixed(2)}',
- style: theme.textTheme.titleMedium,
- ),
- const SizedBox(height: 6),
- ...finding.supportingEvidence.map(
- (item) => Text('- $item'),
- ),
- const SizedBox(height: 4),
- ...finding.contradictingEvidence.map(
- (item) => Text('Conflict: $item'),
- ),
- ],
- ),
- ),
- ),
- Text('Uncertainty', style: theme.textTheme.titleLarge),
- const SizedBox(height: 8),
- ...conclusion.uncertainty.map(
- (item) => Text('- $item'),
- ),
- const SizedBox(height: 16),
- Text(
- 'Suggested Next Actions',
- style: theme.textTheme.titleLarge,
- ),
- const SizedBox(height: 8),
- ...conclusion.suggestedNextActions.map(
- (item) => Text('- $item'),
- ),
- ],
- ),
- ),
- ),
- ],
- );
- },
- ),
- ],
- );
- }
- }
|