Auto dark/bright follows the sun at the tablet's own location
Without a light sensor an app may read (the Redmi Pad SE has none), auto is dark while the sun is more than 4° below the horizon (lib/theme/sun.dart), at Android's coarse location, polled and kept across restarts. The tablet's own, not the Orin's GNSS: the tablet has its own GNSS and cellular. Android's dark theme is the last fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ enum VariantMode { auto, dark, bright }
|
||||
|
||||
/// A theme: both variants, and which one is showing. Listen to it to follow a switch.
|
||||
/// In auto it follows a light sensor ([followLight]) where the device lets an app read
|
||||
/// one; else the sun at the car's last position ([setPosition]); else Android's dark
|
||||
/// one; else the sun at the tablet's last location ([setPosition]); else Android's dark
|
||||
/// theme (by hand or on its schedule). The mode and the position are kept across restarts.
|
||||
class Themes extends ChangeNotifier with WidgetsBindingObserver {
|
||||
Themes(
|
||||
@@ -210,7 +210,7 @@ class Themes extends ChangeNotifier with WidgetsBindingObserver {
|
||||
bool? _sunDark;
|
||||
late final Timer _sunTimer;
|
||||
|
||||
/// The car's position, for the sun. Kept (to 0.1°, about 10 km: plenty for the sun)
|
||||
/// The tablet's location, for the sun. Kept (to 0.1°, about 10 km: plenty for the sun)
|
||||
/// so auto knows the sun before the first fix.
|
||||
void setPosition(double lat, double lon) {
|
||||
double r(double x) => (x * 10).round() / 10;
|
||||
|
||||
Reference in New Issue
Block a user