style: make theme switching inactive and enable light theme by default

Workaround for #144
This commit is contained in:
Martin Wimpress 2024-06-28 15:14:08 +01:00 committed by Martin Wimpress
parent 38055236d3
commit 0490c83790
2 changed files with 15 additions and 7 deletions

View File

@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
import 'package:quickgui/src/supported_locales.dart';
class AppSettings extends ChangeNotifier {
ThemeMode? _themeMode;
ThemeMode _themeMode = ThemeMode.light;
String? _activeLocale;
ThemeMode get themeMode => _themeMode ?? ThemeMode.system;
ThemeMode get themeMode => _themeMode;
String get activeLocale => _activeLocale ?? Platform.localeName;
@ -38,8 +38,7 @@ class AppSettings extends ChangeNotifier {
}
set useDarkModeSilently(bool useDarkMode) {
//_themeMode = useDarkMode ? ThemeMode.dark : ThemeMode.light;
_themeMode = ThemeMode.light;
_themeMode = useDarkMode ? ThemeMode.dark : ThemeMode.light;
}
set useDarkMode(bool useDarkMode) {

View File

@ -48,18 +48,27 @@ class _LeftMenuState extends State<LeftMenu> with PreferencesMixin {
title: Text("Quickgui $_version",
style: Theme.of(context).textTheme.titleLarge),
),
/*
const Divider(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Text(context.t('Use dark mode')),
Text(context.t('Use dark mode'),
style: TextStyle(
color: Colors.grey[300],
),
),
Expanded(
child: Container(),
),
Switch(
value: Theme.of(context).colorScheme.brightness == Brightness.dark,
onChanged: null,
activeColor: Colors.grey[300],
activeTrackColor: Colors.grey[300],
inactiveThumbColor: Colors.grey[300],
inactiveTrackColor: Colors.grey[300],
/*
onChanged: (value) {
appSettings.useDarkMode = value;
savePreference(prefThemeMode, value);
@ -68,11 +77,11 @@ class _LeftMenuState extends State<LeftMenu> with PreferencesMixin {
activeTrackColor: Colors.black26,
inactiveThumbColor: Theme.of(context).colorScheme.onPrimary,
inactiveTrackColor: Theme.of(context).colorScheme.primary,
*/
),
],
),
),
*/
const Divider(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),