Skip to content

Commit

Permalink
style: make theme switching inactive and enable light theme by default
Browse files Browse the repository at this point in the history
Workaround for #144
  • Loading branch information
flexiondotorg committed Jun 28, 2024
1 parent 3805523 commit 0490c83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/src/model/app_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
15 changes: 12 additions & 3 deletions lib/src/widgets/left_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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),
Expand Down

0 comments on commit 0490c83

Please sign in to comment.