Auto dark/bright follows the sun at the tablet's own location
/ crosscheck (push) Successful in 1s
CI / Analyze & Test (push) Successful in 22s
CI / Debug APK (push) Successful in 39s

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:
2026-10-15 22:33:43 +09:00
parent 317de3425a
commit 31a844bb94
9 changed files with 164 additions and 19 deletions
+2 -2
View File
@@ -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;