Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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