Clean Architecture structure: - core/config - Environment configuration - core/theme - Material 3 theming with FlexColorScheme - core/error - Typed exception hierarchy - core/api - Dio HTTP clients with interceptors - core/auth - Authentication state management - routing - go_router with shell navigation - shared/layouts - Adaptive scaffold Dependencies added: - flutter_riverpod, riverpod_annotation, riverpod_generator - freezed, freezed_annotation, json_serializable - dio, go_router, shared_preferences - flex_color_scheme, flutter_adaptive_scaffold Features: - Responsive navigation (rail on desktop, bottom on mobile) - Dashboard placeholder with welcome card - Theme switching infrastructure - API client ready for Core API and Tatlock API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
2.2 KiB
Dart
73 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../routing/app_router.dart';
|
|
|
|
/// Main application scaffold with adaptive navigation.
|
|
class AppScaffold extends StatelessWidget {
|
|
const AppScaffold({super.key, required this.child});
|
|
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AdaptiveScaffold(
|
|
selectedIndex: _selectedIndex(context),
|
|
onSelectedIndexChange: (index) => _onNavSelected(context, index),
|
|
destinations: const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.dashboard_outlined),
|
|
selectedIcon: Icon(Icons.dashboard),
|
|
label: 'Dashboard',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.chat_outlined),
|
|
selectedIcon: Icon(Icons.chat),
|
|
label: 'Tatlock',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.dns_outlined),
|
|
selectedIcon: Icon(Icons.dns),
|
|
label: 'Containers',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.home_outlined),
|
|
selectedIcon: Icon(Icons.home),
|
|
label: 'Housekeeping',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.settings_outlined),
|
|
selectedIcon: Icon(Icons.settings),
|
|
label: 'Settings',
|
|
),
|
|
],
|
|
body: (_) => child,
|
|
smallBody: (_) => child,
|
|
useDrawer: false,
|
|
);
|
|
}
|
|
|
|
int _selectedIndex(BuildContext context) {
|
|
final location = GoRouterState.of(context).matchedLocation;
|
|
|
|
if (location.startsWith(AppRoutes.containers)) return 2;
|
|
if (location.startsWith(AppRoutes.chat)) return 1;
|
|
if (location.startsWith(AppRoutes.housekeeping)) return 3;
|
|
if (location.startsWith(AppRoutes.settings)) return 4;
|
|
return 0; // Dashboard
|
|
}
|
|
|
|
void _onNavSelected(BuildContext context, int index) {
|
|
final route = switch (index) {
|
|
0 => AppRoutes.dashboard,
|
|
1 => AppRoutes.chat,
|
|
2 => AppRoutes.containers,
|
|
3 => AppRoutes.housekeeping,
|
|
4 => AppRoutes.settings,
|
|
_ => AppRoutes.dashboard,
|
|
};
|
|
context.go(route);
|
|
}
|
|
}
|