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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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