- Implemented RawFrameDebugScreen for displaying ECU frame data and diagnostics. - Created DtcScreen to show active Diagnostic Trouble Codes (DTCs) with detailed descriptions. - Added DtcRow widget for individual DTC representation. - Introduced GraphScreen for visualizing sensor data over time with customizable time windows. - Developed SensorListScreen to display available sensors and their current values. - Enhanced SettingsScreen with options for Bluetooth connection, ECU protocol selection, polling interval, and theme settings. - Added AppColors and AppTheme for consistent theming across the application. - Implemented BtStatusChip to show Bluetooth connection status in the app bar. - Created RecordFab for starting and stopping data recording sessions.
93 lines
2.6 KiB
Dart
93 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../screens/dashboard/dashboard_screen.dart';
|
|
import '../screens/sensor_list/sensor_list_screen.dart';
|
|
import '../screens/graph/graph_screen.dart';
|
|
import '../screens/dtc/dtc_screen.dart';
|
|
import '../screens/datalog/datalog_list_screen.dart';
|
|
import '../screens/debug/raw_frame_debug_screen.dart';
|
|
import '../screens/settings/settings_screen.dart';
|
|
import 'bt_status_chip.dart';
|
|
import 'record_fab.dart';
|
|
|
|
final _navIndexProvider = StateProvider<int>((ref) => 0);
|
|
|
|
class MainNav extends ConsumerWidget {
|
|
const MainNav({super.key});
|
|
|
|
static const _screens = [
|
|
DashboardScreen(),
|
|
SensorListScreen(),
|
|
GraphScreen(),
|
|
DtcScreen(),
|
|
];
|
|
|
|
static const _items = [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.speed),
|
|
label: 'Dashboard',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.list_alt),
|
|
label: 'Sensors',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.show_chart),
|
|
label: 'Graph',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.warning_amber_outlined),
|
|
label: 'DTC',
|
|
),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final index = ref.watch(_navIndexProvider);
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('HV BT Dashboard'),
|
|
actions: [
|
|
const BtStatusChip(),
|
|
IconButton(
|
|
icon: const Icon(Icons.folder_open_outlined),
|
|
tooltip: 'Saved Sessions',
|
|
onPressed: () => Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => const DatalogListScreen()),
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.bug_report_outlined),
|
|
tooltip: 'ECU Frame Debug',
|
|
onPressed: () => Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => const RawFrameDebugScreen()),
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.settings_outlined),
|
|
tooltip: 'Settings',
|
|
onPressed: () => Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => const SettingsScreen()),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
body: IndexedStack(
|
|
index: index,
|
|
children: _screens,
|
|
),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: index,
|
|
items: _items,
|
|
onTap: (i) => ref.read(_navIndexProvider.notifier).state = i,
|
|
),
|
|
floatingActionButton: const RecordFab(),
|
|
);
|
|
}
|
|
}
|