Dark/bright: Auto (Android's dark theme), Dark or Bright, kept across restarts
/ crosscheck (push) Successful in 1s
CI / Analyze & Test (push) Successful in 19s
CI / Debug APK (push) Successful in 1m5s

Settings has a segmented Auto / Dark / Bright. Auto follows platformBrightness, so
Android's schedule too. The Dash's quick button holds the other variant; a long press
is auto again. The mode is kept with shared_preferences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 22:14:29 +09:00
parent 0d0940e6b7
commit 78a6564f0a
8 changed files with 285 additions and 28 deletions
+13 -7
View File
@@ -164,7 +164,7 @@ class DashPage extends StatelessWidget {
}
}
/// The dash's own thin top line: the menu, link state, and the dark/bright switch.
/// The dash's own thin top line: the menu, link state, and the dark/bright quick switch.
class _DashBar extends StatelessWidget {
const _DashBar({required this.boundary, required this.themes});
final Boundary boundary;
@@ -185,12 +185,18 @@ class _DashBar extends StatelessWidget {
MenuButton(color: p.subdued),
Text(text, style: TextStyle(color: color, letterSpacing: 2)),
const Spacer(),
IconButton(
tooltip: themes.isDark ? 'Bright' : 'Dark',
onPressed: themes.toggle,
icon: Icon(
themes.isDark ? Icons.light_mode : Icons.dark_mode,
color: p.subdued,
// Tap: hold the other variant. Long press: back to auto (Settings has both).
GestureDetector(
onLongPress: () => themes.mode = VariantMode.auto,
child: IconButton(
tooltip: themes.isDark ? 'Bright' : 'Dark',
onPressed: themes.toggle,
icon: Icon(
themes.mode == VariantMode.auto
? Icons.brightness_auto
: (themes.isDark ? Icons.light_mode : Icons.dark_mode),
color: p.subdued,
),
),
),
],
+31 -7
View File
@@ -52,14 +52,38 @@ class SettingsPage extends StatelessWidget {
onTap: () => editUrl(context, boundary, usb),
),
section('Display'),
SwitchListTile(
secondary: Icon(
themes.isDark ? Icons.dark_mode : Icons.light_mode,
ListTile(
leading: Icon(themes.isDark ? Icons.dark_mode : Icons.light_mode),
title: const Text('Dark or bright'),
subtitle: const Text(
"Auto follows Android's dark theme and its schedule. "
"The Dash's button holds one; a long press there is auto again.",
),
),
Padding(
padding: const EdgeInsets.fromLTRB(72, 0, 16, 8),
child: SegmentedButton<VariantMode>(
segments: const [
ButtonSegment(
value: VariantMode.auto,
icon: Icon(Icons.brightness_auto),
label: Text('Auto'),
),
ButtonSegment(
value: VariantMode.dark,
icon: Icon(Icons.dark_mode),
label: Text('Dark'),
),
ButtonSegment(
value: VariantMode.bright,
icon: Icon(Icons.light_mode),
label: Text('Bright'),
),
],
selected: {themes.mode},
showSelectedIcon: false,
onSelectionChanged: (s) => themes.mode = s.single,
),
title: const Text('Dark variant'),
subtitle: const Text('Bright for daylight, dark for night'),
value: themes.isDark,
onChanged: (v) => themes.isDark = v,
),
ListTile(
leading: const Icon(Icons.palette),