Implement v1.1 enhancements: auto-rotate, interactive gauge, and extended units
Features added: - Auto-rotate support for portrait/landscape orientations - Interactive gauge: tap to switch between digital and analog modes - Extended speed units: added knots with quick selector buttons - New SpeedUnitSelector widget for convenient unit switching Known issues identified: - 10 package dependencies need updates to latest compatible versions - Orientation switching needs to override system auto-rotate toggle - Background color customization moved back to TODO (build issues) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
enum SpeedUnit { kmh, mph }
|
||||
enum SpeedUnit { kmh, mph, knots }
|
||||
enum SpeedometerStyle { digital, analog }
|
||||
|
||||
class SettingsProvider extends ChangeNotifier {
|
||||
@@ -21,7 +21,16 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool get showTripTime => _showTripTime;
|
||||
bool get showAccuracy => _showAccuracy;
|
||||
|
||||
String get speedUnitString => _speedUnit == SpeedUnit.kmh ? 'km/h' : 'mph';
|
||||
String get speedUnitString {
|
||||
switch (_speedUnit) {
|
||||
case SpeedUnit.kmh:
|
||||
return 'km/h';
|
||||
case SpeedUnit.mph:
|
||||
return 'mph';
|
||||
case SpeedUnit.knots:
|
||||
return 'knots';
|
||||
}
|
||||
}
|
||||
|
||||
SettingsProvider() {
|
||||
_loadSettings();
|
||||
@@ -89,10 +98,13 @@ class SettingsProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
double convertSpeed(double speedMps) {
|
||||
if (_speedUnit == SpeedUnit.kmh) {
|
||||
return speedMps * 3.6;
|
||||
} else {
|
||||
return speedMps * 2.237;
|
||||
switch (_speedUnit) {
|
||||
case SpeedUnit.kmh:
|
||||
return speedMps * 3.6;
|
||||
case SpeedUnit.mph:
|
||||
return speedMps * 2.237;
|
||||
case SpeedUnit.knots:
|
||||
return speedMps * 1.944;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user