style: make theme switching inactive and enable light theme by default
Workaround for #144
This commit is contained in:
parent
38055236d3
commit
0490c83790
|
|
@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:quickgui/src/supported_locales.dart';
|
import 'package:quickgui/src/supported_locales.dart';
|
||||||
|
|
||||||
class AppSettings extends ChangeNotifier {
|
class AppSettings extends ChangeNotifier {
|
||||||
ThemeMode? _themeMode;
|
ThemeMode _themeMode = ThemeMode.light;
|
||||||
String? _activeLocale;
|
String? _activeLocale;
|
||||||
|
|
||||||
ThemeMode get themeMode => _themeMode ?? ThemeMode.system;
|
ThemeMode get themeMode => _themeMode;
|
||||||
|
|
||||||
String get activeLocale => _activeLocale ?? Platform.localeName;
|
String get activeLocale => _activeLocale ?? Platform.localeName;
|
||||||
|
|
||||||
|
|
@ -38,8 +38,7 @@ class AppSettings extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
set useDarkModeSilently(bool useDarkMode) {
|
set useDarkModeSilently(bool useDarkMode) {
|
||||||
//_themeMode = useDarkMode ? ThemeMode.dark : ThemeMode.light;
|
_themeMode = useDarkMode ? ThemeMode.dark : ThemeMode.light;
|
||||||
_themeMode = ThemeMode.light;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set useDarkMode(bool useDarkMode) {
|
set useDarkMode(bool useDarkMode) {
|
||||||
|
|
|
||||||
|
|
@ -48,18 +48,27 @@ class _LeftMenuState extends State<LeftMenu> with PreferencesMixin {
|
||||||
title: Text("Quickgui $_version",
|
title: Text("Quickgui $_version",
|
||||||
style: Theme.of(context).textTheme.titleLarge),
|
style: Theme.of(context).textTheme.titleLarge),
|
||||||
),
|
),
|
||||||
/*
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(context.t('Use dark mode')),
|
Text(context.t('Use dark mode'),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey[300],
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(),
|
child: Container(),
|
||||||
),
|
),
|
||||||
Switch(
|
Switch(
|
||||||
value: Theme.of(context).colorScheme.brightness == Brightness.dark,
|
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) {
|
onChanged: (value) {
|
||||||
appSettings.useDarkMode = value;
|
appSettings.useDarkMode = value;
|
||||||
savePreference(prefThemeMode, value);
|
savePreference(prefThemeMode, value);
|
||||||
|
|
@ -68,11 +77,11 @@ class _LeftMenuState extends State<LeftMenu> with PreferencesMixin {
|
||||||
activeTrackColor: Colors.black26,
|
activeTrackColor: Colors.black26,
|
||||||
inactiveThumbColor: Theme.of(context).colorScheme.onPrimary,
|
inactiveThumbColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
inactiveTrackColor: Theme.of(context).colorScheme.primary,
|
inactiveTrackColor: Theme.of(context).colorScheme.primary,
|
||||||
|
*/
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
*/
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue