- 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.
86 lines
2.8 KiB
Dart
86 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/models/sensor_defs.dart';
|
|
|
|
class SensorPickerSheet extends StatelessWidget {
|
|
final String currentId;
|
|
final void Function(String id) onSelected;
|
|
|
|
const SensorPickerSheet({
|
|
super.key,
|
|
required this.currentId,
|
|
required this.onSelected,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DraggableScrollableSheet(
|
|
expand: false,
|
|
initialChildSize: 0.6,
|
|
minChildSize: 0.4,
|
|
maxChildSize: 0.9,
|
|
builder: (context, scrollController) {
|
|
return Container(
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xFF1A1A1A),
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 8),
|
|
Container(
|
|
width: 40, height: 4,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white24,
|
|
borderRadius: BorderRadius.circular(2),
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16),
|
|
child: Text(
|
|
'SELECT SENSOR',
|
|
style: TextStyle(
|
|
color: Colors.white70,
|
|
fontSize: 12,
|
|
letterSpacing: 2,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
const Divider(height: 1, color: Colors.white10),
|
|
Expanded(
|
|
child: ListView.builder(
|
|
controller: scrollController,
|
|
itemCount: sensorDefs.length,
|
|
itemBuilder: (context, i) {
|
|
final def = sensorDefs[i];
|
|
final isSelected = def.id == currentId;
|
|
return ListTile(
|
|
title: Text(
|
|
def.displayName,
|
|
style: TextStyle(
|
|
color: isSelected ? Colors.white : Colors.white70,
|
|
fontWeight: isSelected
|
|
? FontWeight.bold
|
|
: FontWeight.normal,
|
|
),
|
|
),
|
|
subtitle: Text(
|
|
def.unit,
|
|
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
|
),
|
|
trailing: isSelected
|
|
? const Icon(Icons.check, color: Colors.green, size: 18)
|
|
: null,
|
|
onTap: () => onSelected(def.id),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|