import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:tatlock_ui/features/front_hall/presentation/providers/front_hall_state_provider.dart'; import 'package:tatlock_ui/features/front_hall/presentation/widgets/dashboard_content.dart'; import 'package:tatlock_ui/features/front_hall/presentation/widgets/iframe_view.dart'; import 'package:tatlock_ui/features/front_hall/presentation/widgets/quick_link_settings_content.dart'; import 'package:tatlock_ui/features/front_hall/presentation/widgets/quick_links_panel.dart'; /// Front Hall - estate overview and quick access. /// /// Three-mode content area: /// - Dashboard: Stats, weather, welcome message /// - Iframe: Embedded external content (web only) /// - Settings: Quick link management class FrontHallPage extends ConsumerWidget { const FrontHallPage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final colorScheme = Theme.of(context).colorScheme; final frontHallState = ref.watch(frontHallStateProvider); return Row( children: [ // Left panel - Quick Links const QuickLinksPanel(), // Vertical divider VerticalDivider( width: 1, thickness: 1, color: colorScheme.outlineVariant, ), // Main content area - switches based on mode Expanded( child: _buildContent(context, ref, frontHallState), ), ], ); } Widget _buildContent( BuildContext context, WidgetRef ref, FrontHallState state, ) { switch (state.mode) { case FrontHallMode.dashboard: return const DashboardContent(); case FrontHallMode.iframe: return IframeView( key: ValueKey(state.activeIframeUrl), url: state.activeIframeUrl!, title: state.activeIframeTitle ?? 'External Content', onClose: () => ref.read(frontHallStateProvider.notifier).showDashboard(), ); case FrontHallMode.settings: return const QuickLinkSettingsContent(); } } }