- 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.
67 lines
2.0 KiB
Dart
67 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/protocol/sensor_state.dart';
|
|
|
|
class FlagPill extends StatelessWidget {
|
|
final String label;
|
|
final bool active;
|
|
final Color color;
|
|
|
|
const FlagPill({
|
|
super.key,
|
|
required this.label,
|
|
required this.active,
|
|
required this.color,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 100),
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
decoration: BoxDecoration(
|
|
color: active ? color.withAlpha(40) : const Color(0xFF1A1A1A),
|
|
borderRadius: BorderRadius.circular(20),
|
|
border: Border.all(
|
|
color: active ? color : Colors.white12,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(
|
|
color: active ? color : Colors.grey,
|
|
fontSize: 11,
|
|
fontWeight: active ? FontWeight.bold : FontWeight.normal,
|
|
letterSpacing: 1,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Row of all flag pills derived from a SensorState.
|
|
class FlagRow extends StatelessWidget {
|
|
final SensorState state;
|
|
final Color accentColor;
|
|
|
|
const FlagRow({super.key, required this.state, required this.accentColor});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Wrap(
|
|
spacing: 6,
|
|
runSpacing: 6,
|
|
alignment: WrapAlignment.center,
|
|
children: [
|
|
FlagPill(label: 'MIL', active: state.mil, color: Colors.amber),
|
|
FlagPill(label: 'VTEC', active: state.vtec, color: Colors.blue),
|
|
FlagPill(label: 'KNOCK', active: state.knock, color: Colors.red),
|
|
FlagPill(label: 'FUEL CUT', active: state.fuelCut, color: Colors.red),
|
|
FlagPill(label: 'REV LIM', active: state.revLimit, color: Colors.orange),
|
|
FlagPill(label: 'FAN', active: state.fanOut, color: Colors.green),
|
|
FlagPill(label: 'LAUNCH', active: state.launch, color: Colors.purple),
|
|
],
|
|
);
|
|
}
|
|
}
|