Files
friflex_flutter_starter/lib/features/root/root_screen.dart

47 lines
1.9 KiB
Dart
Raw Normal View History

2025-01-21 14:24:31 +03:00
import 'package:flutter/material.dart';
import 'package:friflex_starter/app/app_context_ext.dart';
import 'package:friflex_starter/app/app_env.dart';
import 'package:friflex_starter/features/debug/debug_routes.dart';
2025-01-21 14:24:31 +03:00
import 'package:go_router/go_router.dart';
/// {@template root_screen}
/// Корневой экран приложения с навигационной структурой.
///
/// Отвечает за:
/// - Отображение основного навигационного интерфейса
/// - Управление переключением между основными разделами приложения
/// - Отображение кнопки отладки в не-продакшн окружениях
/// - Интеграцию с GoRouter для навигации
/// {@endtemplate}
2025-01-21 14:24:31 +03:00
class RootScreen extends StatelessWidget {
/// {@macro root_screen}
const RootScreen({required this.navigationShell, super.key});
2025-01-21 14:24:31 +03:00
/// Текущая ветка навигации от GoRouter
/// Содержит информацию о текущем состоянии навигации
2025-01-21 14:24:31 +03:00
final StatefulNavigationShell navigationShell;
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: context.di.env != AppEnv.prod
? FloatingActionButton(
child: const Icon(Icons.bug_report),
onPressed: () {
context.pushNamed(DebugRoutes.debugScreenName);
},
)
: null,
2025-01-21 14:24:31 +03:00
body: navigationShell,
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Главная'),
BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Профиль'),
2025-01-21 14:24:31 +03:00
],
currentIndex: navigationShell.currentIndex,
onTap: navigationShell.goBranch,
),
);
}
}