56 lines
1.9 KiB
Dart
56 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../rides/ride_state_machine.dart';
|
|
|
|
class LeanVisualizer extends StatelessWidget {
|
|
final double lean;
|
|
final RideSession session;
|
|
|
|
const LeanVisualizer({super.key, required this.lean, required this.session});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
const Text('LEAN ANGLE', style: TextStyle(color: Colors.white54, fontSize: 12, letterSpacing: 2)),
|
|
const SizedBox(height: 8),
|
|
Container(
|
|
width: 100,
|
|
height: 100,
|
|
alignment: Alignment.center,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
const Icon(Icons.speed, size: 100, color: Colors.white10),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'${lean.abs().toStringAsFixed(0)}°',
|
|
style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold, color: Colors.white),
|
|
),
|
|
Text(
|
|
lean > 0.5 ? 'RIGHT' : (lean < -0.5 ? 'LEFT' : 'UPRIGHT'),
|
|
style: TextStyle(fontSize: 10, color: lean.abs() > 0.5 ? Theme.of(context).colorScheme.primary : Colors.white54),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text('L: ${session.maxLeanLeft.toStringAsFixed(0)}°', style: TextStyle(color: Theme.of(context).colorScheme.secondary, fontSize: 12)),
|
|
const SizedBox(width: 12),
|
|
Text('R: ${session.maxLeanRight.toStringAsFixed(0)}°', style: TextStyle(color: Theme.of(context).colorScheme.secondary, fontSize: 12)),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|