Dashboard - Selectable main sensor (gauge) + sub sensor, 10 selectable values (landscape 5 left + 5 right, portrait 2x5 on one screen) and 4 selectable flags; long-press to change; persisted. - Flags: the requirement examples (MIL, FAN Out, VTEC Out, Knock, WBO / IAT / CLT Error - errors derived from the stored DTC bits) plus the other S300 status bits (cuts, launch, closed loop, VTP, AC, brake). - Record button moved to the app bar; debug screen moved to Settings. Sensor list: 1 column on phone portrait, 2 on tablet/landscape; name, unit, min/max, segmented bar and value. Graph: auto-scaled Y, window max/min, current value, seconds axis and a touch cursor; RPM/MAP/TPS/ECT by default. Units: km/h|mph, degC|degF, kPa|bar|psi (display only), persisted. Light/dark: palette is a ThemeExtension used by every screen; theme persisted. SafeArea keeps content off the side navigation bar. Datalog playback now drives the dashboard, list, graph and DTC screen, with the playback bar on the main screen and seek updating the displays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Dart
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 : Theme.of(context).dividerColor,
|
|
),
|
|
),
|
|
child: Text(
|
|
s >= 60 ? '${s ~/ 60}m' : '${s}s',
|
|
style: TextStyle(
|
|
color: selected ? accent : Theme.of(context).hintColor,
|
|
fontSize: 12,
|
|
fontWeight: selected ? FontWeight.bold : FontWeight.normal,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}).toList(),
|
|
);
|
|
}
|
|
}
|