Improvements

This commit is contained in:
JHubi1 2024-06-18 17:42:17 +02:00
parent 71e71d3e96
commit a1ce8686f0
No known key found for this signature in database
GPG Key ID: 7BF82570CBBBD050
8 changed files with 27 additions and 29 deletions

View File

@ -137,12 +137,9 @@ class _AppState extends State<App> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DynamicColorBuilder( return DynamicColorBuilder(
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) { builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
if ((prefs?.getBool("useDeviceTheme") ?? false) && if (!(prefs?.getBool("useDeviceTheme") ?? false) ||
lightDynamic != null && lightDynamic == null ||
darkDynamic != null) { darkDynamic == null) {
theme = ThemeData.from(colorScheme: lightDynamic);
themeDark = ThemeData.from(colorScheme: darkDynamic);
} else {
theme = ThemeData.from( theme = ThemeData.from(
colorScheme: const ColorScheme( colorScheme: const ColorScheme(
brightness: Brightness.light, brightness: Brightness.light,
@ -165,6 +162,9 @@ class _AppState extends State<App> {
onError: Colors.black, onError: Colors.black,
surface: Colors.black, surface: Colors.black,
onSurface: Colors.white)); onSurface: Colors.white));
} else {
theme = ThemeData.from(colorScheme: lightDynamic);
themeDark = ThemeData.from(colorScheme: darkDynamic);
} }
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'main.dart'; import 'main.dart';
import 'worker/haptic.dart'; import 'worker/haptic.dart';
import 'worker/update.dart';
import 'package:ollama_app/worker/setter.dart'; import 'package:ollama_app/worker/setter.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -89,9 +90,7 @@ Widget toggle(BuildContext context, String text, bool value,
? WidgetStatePropertyAll(Theme.of(context) ? WidgetStatePropertyAll(Theme.of(context)
.colorScheme .colorScheme
.primary .primary
.withAlpha(150) .withAlpha(150))
.harmonizeWith(
Theme.of(context).colorScheme.primary))
: null, : null,
thumbColor: disabled thumbColor: disabled
? WidgetStatePropertyAll(Theme.of(context) ? WidgetStatePropertyAll(Theme.of(context)
@ -235,6 +234,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
super.initState(); super.initState();
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
checkHost(); checkHost();
updatesSupported(setState, true);
} }
@override @override
@ -302,7 +302,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
const SizedBox(height: 16), const SizedBox(height: 8),
TextField( TextField(
controller: hostInputController, controller: hostInputController,
keyboardType: TextInputType.url, keyboardType: TextInputType.url,
@ -377,11 +377,9 @@ class _ScreenSettingsState extends State<ScreenSettings> {
child: Row( child: Row(
children: [ children: [
Icon(Icons.error_rounded, Icon(Icons.error_rounded,
color: Colors.red color: Theme.of(context)
.harmonizeWith( .colorScheme
Theme.of(context) .error),
.colorScheme
.primary)),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
AppLocalizations.of(context)! AppLocalizations.of(context)!
@ -390,11 +388,9 @@ class _ScreenSettingsState extends State<ScreenSettings> {
? "host" ? "host"
: "url"), : "url"),
style: TextStyle( style: TextStyle(
color: Colors.red color: Theme.of(context)
.harmonizeWith( .colorScheme
Theme.of(context) .error))
.colorScheme
.primary)))
], ],
)) ))
: null, : null,
@ -504,7 +500,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
}) })
]), ]),
), ),
const SizedBox(height: 16), const SizedBox(height: 8),
button( button(
AppLocalizations.of(context)! AppLocalizations.of(context)!
.settingsSavedAutomatically, .settingsSavedAutomatically,

View File

@ -49,6 +49,7 @@ class _ScreenWelcomeState extends State<ScreenWelcome> {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: systemNavigationBarColor:
(prefs!.getString("brightness") ?? "system") == "system" (prefs!.getString("brightness") ?? "system") == "system"
// ignore: use_build_context_synchronously
? ((MediaQuery.of(context).platformBrightness == ? ((MediaQuery.of(context).platformBrightness ==
Brightness.light) Brightness.light)
? Colors.grey[100] ? Colors.grey[100]
@ -58,6 +59,7 @@ class _ScreenWelcomeState extends State<ScreenWelcome> {
: Colors.grey[100]), : Colors.grey[100]),
systemNavigationBarIconBrightness: systemNavigationBarIconBrightness:
(((prefs!.getString("brightness") ?? "system") == "system" && (((prefs!.getString("brightness") ?? "system") == "system" &&
// ignore: use_build_context_synchronously
MediaQuery.of(context).platformBrightness == MediaQuery.of(context).platformBrightness ==
Brightness.light) || Brightness.light) ||
prefs!.getString("brightness") == "light") prefs!.getString("brightness") == "light")

View File

@ -84,7 +84,7 @@ class _ScreenSettingsAboutState extends State<ScreenSettingsAbout> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
// const SizedBox(height: 16), // const SizedBox(height: 8),
button( button(
AppLocalizations.of(context)! AppLocalizations.of(context)!
.settingsVersion(currentVersion ?? ""), .settingsVersion(currentVersion ?? ""),

View File

@ -79,7 +79,7 @@ class _ScreenSettingsBehaviorState extends State<ScreenSettingsBehavior> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
const SizedBox(height: 16), const SizedBox(height: 8),
TextField( TextField(
controller: systemInputController, controller: systemInputController,
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
@ -111,7 +111,7 @@ class _ScreenSettingsBehaviorState extends State<ScreenSettingsBehavior> {
}) })
]), ]),
), ),
const SizedBox(height: 16), const SizedBox(height: 8),
button( button(
AppLocalizations.of(context)! AppLocalizations.of(context)!
.settingsBehaviorNotUpdatedForOlderChats, .settingsBehaviorNotUpdatedForOlderChats,

View File

@ -73,7 +73,7 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
// const SizedBox(height: 16), // const SizedBox(height: 8),
button(AppLocalizations.of(context)!.settingsExportChats, button(AppLocalizations.of(context)!.settingsExportChats,
Icons.upload_rounded, () async { Icons.upload_rounded, () async {
selectionHaptic(); selectionHaptic();
@ -167,7 +167,7 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
}) })
]), ]),
), ),
const SizedBox(height: 16), const SizedBox(height: 8),
button(AppLocalizations.of(context)!.settingsExportInfo, button(AppLocalizations.of(context)!.settingsExportInfo,
Icons.info_rounded, null, Icons.info_rounded, null,
color: Colors.grey color: Colors.grey

View File

@ -72,7 +72,7 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
// const SizedBox(height: 16), // const SizedBox(height: 8),
toggle( toggle(
context, context,
AppLocalizations.of(context)!.settingsShowModelTags, AppLocalizations.of(context)!.settingsShowModelTags,

View File

@ -56,7 +56,7 @@ class _ScreenSettingsVoiceState extends State<ScreenSettingsVoice> {
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
// const SizedBox(height: 16), // const SizedBox(height: 8),
((prefs!.getBool("voiceModeEnabled") ?? false) || ((prefs!.getBool("voiceModeEnabled") ?? false) ||
permissionLoading || permissionLoading ||
(permissionBluetooth && (permissionBluetooth &&
@ -324,7 +324,7 @@ class _ScreenSettingsVoiceState extends State<ScreenSettingsVoice> {
!(prefs!.getBool("voiceModeEnabled") ?? false))) !(prefs!.getBool("voiceModeEnabled") ?? false)))
]), ]),
), ),
const SizedBox(height: 16), const SizedBox(height: 8),
button( button(
AppLocalizations.of(context)! AppLocalizations.of(context)!
.settingsExperimentalBetaFeature, .settingsExperimentalBetaFeature,