hondavert-dev/lib/ui/screens/graph/widgets/graph_time_selector.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

50 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
class GraphTimeSelector extends StatelessWidget {
final int windowSeconds;
final void Function(int seconds) onChanged;
static const _options = [30, 60, 120, 300];
const GraphTimeSelector({
super.key,
required this.windowSeconds,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
final accent = Theme.of(context).colorScheme.primary;
return Row(
mainAxisSize: MainAxisSize.min,
children: _options.map((s) {
final selected = s == windowSeconds;
return GestureDetector(
onTap: () => onChanged(s),
child: AnimatedContainer(
duration: const Duration(milliseconds: 120),
margin: const EdgeInsets.only(left: 4),
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: selected ? accent.withAlpha(30) : Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: selected ? accent : Colors.white24,
),
),
child: Text(
s >= 60 ? '${s ~/ 60}m' : '${s}s',
style: TextStyle(
color: selected ? accent : Colors.white54,
fontSize: 12,
fontWeight: selected ? FontWeight.bold : FontWeight.normal,
),
),
),
);
}).toList(),
);
}
}