hondavert-dev/lib/ui/screens/dashboard/dashboard_vertical.dart
HVBT Dev 763821171c feat: Add ECU Frame Debug Screen and DTC Screen
- 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.
2026-07-26 23:14:58 +05:30

81 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/providers/sensor_provider.dart';
import '../../../core/providers/theme_provider.dart';
import '../../../ui/theme/app_colors.dart';
import 'widgets/analog_gauge.dart';
import 'widgets/flag_pill.dart';
import 'widgets/sensor_tile.dart';
import 'widgets/sensor_picker_sheet.dart';
import 'dashboard_slots_provider.dart';
class DashboardVertical extends ConsumerWidget {
const DashboardVertical({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(latestSensorProvider);
final themeVariant = ref.watch(themeProvider);
final colors = AppColors.forTheme(themeVariant);
final slots = ref.watch(dashboardSlotsProvider);
return Container(
color: const Color(0xFF0A0A0A),
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(24, 8, 24, 0),
child: AnalogGauge(
value: state.rpm,
minValue: 0,
maxValue: 9000,
label: 'RPM',
unit: 'rpm',
accentColor: colors.accent,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
child: FlagRow(state: state, accentColor: colors.accent),
),
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: GridView.count(
crossAxisCount: 2,
mainAxisSpacing: 6,
crossAxisSpacing: 6,
childAspectRatio: 2.4,
physics: const NeverScrollableScrollPhysics(),
children: [
for (int i = 0; i < slots.length; i++)
SensorTile(
slotIndex: i,
sensorId: slots[i],
state: state,
accentColor: colors.accent,
onTap: () => _pickSensor(context, ref, i),
),
],
),
),
),
],
),
);
}
void _pickSensor(BuildContext context, WidgetRef ref, int slotIndex) {
showModalBottomSheet<void>(
context: context,
builder: (_) => SensorPickerSheet(
currentId: ref.read(dashboardSlotsProvider)[slotIndex],
onSelected: (id) {
ref.read(dashboardSlotsProvider.notifier).setSlot(slotIndex, id);
Navigator.pop(context);
},
),
);
}
}