Added structure, updated settings
This commit is contained in:
parent
ec55ccde3e
commit
db6feba198
|
@ -232,6 +232,16 @@
|
||||||
"description": "Text displayed as description for reset on model change toggle",
|
"description": "Text displayed as description for reset on model change toggle",
|
||||||
"context": "Visible in the settings view"
|
"context": "Visible in the settings view"
|
||||||
},
|
},
|
||||||
|
"settingsRequestTypeStream": "Stream",
|
||||||
|
"@settingsRequestTypeStream": {
|
||||||
|
"description": "Text displayed as description for stream request type. Do not translate if not required!",
|
||||||
|
"context": "Visible in the settings view"
|
||||||
|
},
|
||||||
|
"settingsRequestTypeRequest": "Request",
|
||||||
|
"@settingsRequestTypeRequest": {
|
||||||
|
"description": "Text displayed as description for request request type. Do not translate if not required!",
|
||||||
|
"context": "Visible in the settings view"
|
||||||
|
},
|
||||||
"settingsGenerateTitles": "Generate titles",
|
"settingsGenerateTitles": "Generate titles",
|
||||||
"@settingsGenerateTitles": {
|
"@settingsGenerateTitles": {
|
||||||
"description": "Text displayed as description for generate titles toggle",
|
"description": "Text displayed as description for generate titles toggle",
|
||||||
|
@ -252,14 +262,14 @@
|
||||||
"description": "Text displayed as description for show tips toggle",
|
"description": "Text displayed as description for show tips toggle",
|
||||||
"context": "Visible in the settings view"
|
"context": "Visible in the settings view"
|
||||||
},
|
},
|
||||||
"settingsRequestTypeStream": "Stream",
|
"settingsEnableHapticFeedback": "Enable haptic feedback",
|
||||||
"@settingsRequestTypeStream": {
|
"@settingsEnableHapticFeedback": {
|
||||||
"description": "Text displayed as description for stream request type. Do not translate if not required!",
|
"description": "Text displayed as description for enable haptic feedback toggle",
|
||||||
"context": "Visible in the settings view"
|
"context": "Visible in the settings view"
|
||||||
},
|
},
|
||||||
"settingsRequestTypeRequest": "Request",
|
"settingsMaximizeOnStart": "Maximize on start",
|
||||||
"@settingsRequestTypeRequest": {
|
"@settingsMaximizeOnStart": {
|
||||||
"description": "Text displayed as description for request request type. Do not translate if not required!",
|
"description": "Text displayed as description for maximize on start toggle",
|
||||||
"context": "Visible in the settings view"
|
"context": "Visible in the settings view"
|
||||||
},
|
},
|
||||||
"settingsBrightnessSystem": "System",
|
"settingsBrightnessSystem": "System",
|
||||||
|
|
|
@ -11,7 +11,8 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'screen_settings.dart';
|
import 'screen_settings.dart';
|
||||||
import 'screen_welcome.dart';
|
import 'screen_welcome.dart';
|
||||||
import 'worker_setter.dart';
|
import 'worker/setter.dart';
|
||||||
|
import 'worker/haptic.dart';
|
||||||
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
|
@ -74,6 +75,9 @@ void main() {
|
||||||
appWindow.minSize = const Size(600, 450);
|
appWindow.minSize = const Size(600, 450);
|
||||||
appWindow.size = const Size(1200, 650);
|
appWindow.size = const Size(1200, 650);
|
||||||
appWindow.alignment = Alignment.center;
|
appWindow.alignment = Alignment.center;
|
||||||
|
if (prefs!.getBool("maximizeOnStart") ?? false) {
|
||||||
|
appWindow.maximize();
|
||||||
|
}
|
||||||
appWindow.show();
|
appWindow.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -218,7 +222,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
customBorder: const RoundedRectangleBorder(
|
customBorder: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(50))),
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!(Platform.isWindows ||
|
if (!(Platform.isWindows ||
|
||||||
Platform.isLinux ||
|
Platform.isLinux ||
|
||||||
Platform.isMacOS) &&
|
Platform.isMacOS) &&
|
||||||
|
@ -254,7 +258,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
customBorder: const RoundedRectangleBorder(
|
customBorder: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(50))),
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!(Platform.isWindows ||
|
if (!(Platform.isWindows ||
|
||||||
Platform.isLinux ||
|
Platform.isLinux ||
|
||||||
Platform.isMacOS) &&
|
Platform.isMacOS) &&
|
||||||
|
@ -302,7 +306,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
customBorder: const RoundedRectangleBorder(
|
customBorder: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(50))),
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
||||||
|
@ -344,7 +348,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
enableFeedback: false,
|
enableFeedback: false,
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
setState(() {
|
setState(() {
|
||||||
tipId = Random().nextInt(5);
|
tipId = Random().nextInt(5);
|
||||||
});
|
});
|
||||||
|
@ -398,7 +402,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
},
|
},
|
||||||
|
@ -406,7 +410,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
.deleteDialogCancel)),
|
.deleteDialogCancel)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
},
|
},
|
||||||
|
@ -421,7 +425,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
return returnValue;
|
return returnValue;
|
||||||
},
|
},
|
||||||
onDismissed: (direction) {
|
onDismissed: (direction) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
for (var i = 0;
|
for (var i = 0;
|
||||||
i < (prefs!.getStringList("chats") ?? []).length;
|
i < (prefs!.getStringList("chats") ?? []).length;
|
||||||
i++) {
|
i++) {
|
||||||
|
@ -452,7 +456,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
customBorder: const RoundedRectangleBorder(
|
customBorder: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(50))),
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!(Platform.isWindows ||
|
if (!(Platform.isWindows ||
|
||||||
Platform.isLinux ||
|
Platform.isLinux ||
|
||||||
Platform.isMacOS) &&
|
Platform.isMacOS) &&
|
||||||
|
@ -464,7 +468,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
chatUuid = jsonDecode(item)["uuid"];
|
chatUuid = jsonDecode(item)["uuid"];
|
||||||
},
|
},
|
||||||
onLongPress: () async {
|
onLongPress: () async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!chatAllowed) return;
|
if (!chatAllowed) return;
|
||||||
if (!allowSettings) return;
|
if (!allowSettings) return;
|
||||||
String oldTitle = jsonDecode(item)["title"];
|
String oldTitle = jsonDecode(item)["title"];
|
||||||
|
@ -717,7 +721,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!chatAllowed) return;
|
if (!chatAllowed) return;
|
||||||
|
|
||||||
if (prefs!.getBool("askBeforeDeletion") ??
|
if (prefs!.getBool("askBeforeDeletion") ??
|
||||||
|
@ -881,7 +885,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
child: MarkdownBody(
|
child: MarkdownBody(
|
||||||
data: p0.text,
|
data: p0.text,
|
||||||
onTapLink: (text, href, title) async {
|
onTapLink: (text, href, title) async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
try {
|
try {
|
||||||
var url = Uri.parse(href!);
|
var url = Uri.parse(href!);
|
||||||
if (await canLaunchUrl(url)) {
|
if (await canLaunchUrl(url)) {
|
||||||
|
@ -918,7 +922,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
(context, error, stackTrace) {
|
(context, error, stackTrace) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
|
@ -947,7 +951,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
} else {
|
} else {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
|
@ -1078,7 +1082,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
AssetImage("assets/logo512.png"),
|
AssetImage("assets/logo512.png"),
|
||||||
size: 44)))),
|
size: 44)))),
|
||||||
onSendPressed: (p0) async {
|
onSendPressed: (p0) async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
setState(() {
|
setState(() {
|
||||||
sendable = false;
|
sendable = false;
|
||||||
});
|
});
|
||||||
|
@ -1208,7 +1212,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
id: newId,
|
id: newId,
|
||||||
text: text));
|
text: text));
|
||||||
setState(() {});
|
setState(() {});
|
||||||
HapticFeedback.lightImpact();
|
lightHaptic();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
llama.GenerateChatCompletionResponse request;
|
llama.GenerateChatCompletionResponse request;
|
||||||
|
@ -1232,7 +1236,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
id: newId,
|
id: newId,
|
||||||
text: request.message!.content));
|
text: request.message!.content));
|
||||||
setState(() {});
|
setState(() {});
|
||||||
HapticFeedback.lightImpact();
|
lightHaptic();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
|
@ -1324,7 +1328,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
chatAllowed = true;
|
chatAllowed = true;
|
||||||
},
|
},
|
||||||
onMessageDoubleTap: (context, p1) {
|
onMessageDoubleTap: (context, p1) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!chatAllowed) return;
|
if (!chatAllowed) return;
|
||||||
if (p1.author == assistant) return;
|
if (p1.author == assistant) return;
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
|
@ -1357,7 +1361,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
onMessageLongPress: (context, p1) async {
|
onMessageLongPress: (context, p1) async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
|
|
||||||
if (!(prefs!.getBool("enableEditing") ?? true)) {
|
if (!(prefs!.getBool("enableEditing") ?? true)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1396,12 +1400,12 @@ class _MainAppState extends State<MainApp> {
|
||||||
onAttachmentPressed: (!multimodal)
|
onAttachmentPressed: (!multimodal)
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (!chatAllowed || model == null) return;
|
if (!chatAllowed || model == null) return;
|
||||||
if (Platform.isWindows ||
|
if (Platform.isWindows ||
|
||||||
Platform.isLinux ||
|
Platform.isLinux ||
|
||||||
Platform.isMacOS) {
|
Platform.isMacOS) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
|
|
||||||
FilePicker.platform
|
FilePicker.platform
|
||||||
.pickFiles(type: FileType.image)
|
.pickFiles(type: FileType.image)
|
||||||
|
@ -1423,7 +1427,7 @@ class _MainAppState extends State<MainApp> {
|
||||||
"data:image/png;base64,$encoded"));
|
"data:image/png;base64,$encoded"));
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,10 +2,10 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import 'main.dart';
|
import 'main.dart';
|
||||||
import 'package:ollama_app/worker_setter.dart';
|
import 'worker/haptic.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';
|
||||||
|
|
||||||
import 'settings/behavior.dart';
|
import 'settings/behavior.dart';
|
||||||
|
@ -166,7 +166,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
hostLoading = false;
|
hostLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -247,7 +247,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
readOnly: useHost,
|
readOnly: useHost,
|
||||||
onSubmitted: (value) {
|
onSubmitted: (value) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
checkHost();
|
checkHost();
|
||||||
},
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
@ -256,7 +256,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
hintText: "http://localhost:11434",
|
hintText: "http://localhost:11434",
|
||||||
prefixIcon: IconButton(
|
prefixIcon: IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
String tmp = await prompt(context,
|
String tmp = await prompt(context,
|
||||||
placeholder:
|
placeholder:
|
||||||
"{\"Authorization\": \"Bearer ...\"}",
|
"{\"Authorization\": \"Bearer ...\"}",
|
||||||
|
@ -290,7 +290,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
const CircularProgressIndicator())
|
const CircularProgressIndicator())
|
||||||
: IconButton(
|
: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
checkHost();
|
checkHost();
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
|
@ -300,7 +300,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
error: (hostInvalidHost || hostInvalidUrl)
|
error: (hostInvalidHost || hostInvalidUrl)
|
||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
content: Text(AppLocalizations
|
content: Text(AppLocalizations
|
||||||
|
@ -331,7 +331,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
: null,
|
: null,
|
||||||
helper: InkWell(
|
helper: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
},
|
},
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
splashFactory: NoSplash.splashFactory,
|
splashFactory: NoSplash.splashFactory,
|
||||||
|
@ -371,7 +371,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
AppLocalizations.of(context)!
|
AppLocalizations.of(context)!
|
||||||
.settingsTitleBehavior,
|
.settingsTitleBehavior,
|
||||||
Icons.psychology_rounded, () {
|
Icons.psychology_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
@ -382,7 +382,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
AppLocalizations.of(context)!
|
AppLocalizations.of(context)!
|
||||||
.settingsTitleInterface,
|
.settingsTitleInterface,
|
||||||
Icons.web_asset_rounded, () {
|
Icons.web_asset_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
@ -392,7 +392,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
button(
|
button(
|
||||||
AppLocalizations.of(context)!.settingsTitleExport,
|
AppLocalizations.of(context)!.settingsTitleExport,
|
||||||
Icons.share_rounded, () {
|
Icons.share_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
@ -402,7 +402,7 @@ class _ScreenSettingsState extends State<ScreenSettings> {
|
||||||
button(
|
button(
|
||||||
AppLocalizations.of(context)!.settingsTitleAbout,
|
AppLocalizations.of(context)!.settingsTitleAbout,
|
||||||
Icons.help_rounded, () {
|
Icons.help_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
import '../screen_settings.dart';
|
import '../screen_settings.dart';
|
||||||
import '../worker_update.dart';
|
import '../worker/haptic.dart';
|
||||||
|
import '../worker/update.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||||
|
@ -97,7 +97,7 @@ class _ScreenSettingsAboutState extends State<ScreenSettingsAbout> {
|
||||||
.settingsCheckForUpdates,
|
.settingsCheckForUpdates,
|
||||||
(prefs!.getBool("checkUpdateOnSettingsOpen") ??
|
(prefs!.getBool("checkUpdateOnSettingsOpen") ??
|
||||||
false), (value) {
|
false), (value) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
prefs!.setBool("checkUpdateOnSettingsOpen", value);
|
prefs!.setBool("checkUpdateOnSettingsOpen", value);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
|
@ -134,7 +134,7 @@ class _ScreenSettingsAboutState extends State<ScreenSettingsAbout> {
|
||||||
? Icons.info_outline_rounded
|
? Icons.info_outline_rounded
|
||||||
: Icons.update_rounded), () {
|
: Icons.update_rounded), () {
|
||||||
if (updateLoading) return;
|
if (updateLoading) return;
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if ((Version.parse(latestVersion ?? "1.0.0") >
|
if ((Version.parse(latestVersion ?? "1.0.0") >
|
||||||
Version.parse(currentVersion ?? "2.0.0")) &&
|
Version.parse(currentVersion ?? "2.0.0")) &&
|
||||||
(updateStatus == "ok")) {
|
(updateStatus == "ok")) {
|
||||||
|
@ -147,21 +147,21 @@ class _ScreenSettingsAboutState extends State<ScreenSettingsAbout> {
|
||||||
titleDivider(),
|
titleDivider(),
|
||||||
button(AppLocalizations.of(context)!.settingsGithub,
|
button(AppLocalizations.of(context)!.settingsGithub,
|
||||||
SimpleIcons.github, () {
|
SimpleIcons.github, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
launchUrl(
|
launchUrl(
|
||||||
mode: LaunchMode.inAppBrowserView,
|
mode: LaunchMode.inAppBrowserView,
|
||||||
Uri.parse(repoUrl));
|
Uri.parse(repoUrl));
|
||||||
}),
|
}),
|
||||||
button(AppLocalizations.of(context)!.settingsReportIssue,
|
button(AppLocalizations.of(context)!.settingsReportIssue,
|
||||||
Icons.report_rounded, () {
|
Icons.report_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
launchUrl(
|
launchUrl(
|
||||||
mode: LaunchMode.inAppBrowserView,
|
mode: LaunchMode.inAppBrowserView,
|
||||||
Uri.parse("$repoUrl/issues"));
|
Uri.parse("$repoUrl/issues"));
|
||||||
}),
|
}),
|
||||||
button(AppLocalizations.of(context)!.settingsMainDeveloper,
|
button(AppLocalizations.of(context)!.settingsMainDeveloper,
|
||||||
Icons.developer_board_rounded, () {
|
Icons.developer_board_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
launchUrl(
|
launchUrl(
|
||||||
mode: LaunchMode.inAppBrowserView,
|
mode: LaunchMode.inAppBrowserView,
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
import '../worker/haptic.dart';
|
||||||
import '../screen_settings.dart';
|
import '../screen_settings.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class _ScreenSettingsBehaviorState extends State<ScreenSettingsBehavior> {
|
||||||
hintText: "You are a helpful assistant",
|
hintText: "You are a helpful assistant",
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
prefs?.setString(
|
prefs?.setString(
|
||||||
"system",
|
"system",
|
||||||
(systemInputController.text.isNotEmpty)
|
(systemInputController.text.isNotEmpty)
|
||||||
|
@ -104,7 +104,7 @@ class _ScreenSettingsBehaviorState extends State<ScreenSettingsBehavior> {
|
||||||
context,
|
context,
|
||||||
AppLocalizations.of(context)!.settingsDisableMarkdown,
|
AppLocalizations.of(context)!.settingsDisableMarkdown,
|
||||||
(prefs!.getBool("noMarkdown") ?? false), (value) {
|
(prefs!.getBool("noMarkdown") ?? false), (value) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
prefs!.setBool("noMarkdown", value);
|
prefs!.setBool("noMarkdown", value);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,9 +2,9 @@ import 'dart:io';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
import '../worker/haptic.dart';
|
||||||
import '../screen_settings.dart';
|
import '../screen_settings.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
|
||||||
// const SizedBox(height: 16),
|
// const SizedBox(height: 16),
|
||||||
button(AppLocalizations.of(context)!.settingsExportChats,
|
button(AppLocalizations.of(context)!.settingsExportChats,
|
||||||
Icons.upload_rounded, () async {
|
Icons.upload_rounded, () async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
var path = await FilePicker.platform.saveFile(
|
var path = await FilePicker.platform.saveFile(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: ["json"],
|
allowedExtensions: ["json"],
|
||||||
|
@ -83,7 +83,7 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
|
||||||
"ollama-export-${DateFormat('yyyy-MM-dd-H-m-s').format(DateTime.now())}.json",
|
"ollama-export-${DateFormat('yyyy-MM-dd-H-m-s').format(DateTime.now())}.json",
|
||||||
bytes: utf8.encode(
|
bytes: utf8.encode(
|
||||||
jsonEncode(prefs!.getStringList("chats") ?? [])));
|
jsonEncode(prefs!.getStringList("chats") ?? [])));
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
if (path == null) return;
|
if (path == null) return;
|
||||||
if (Platform.isWindows ||
|
if (Platform.isWindows ||
|
||||||
Platform.isLinux ||
|
Platform.isLinux ||
|
||||||
|
@ -94,7 +94,7 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
|
||||||
}),
|
}),
|
||||||
button(AppLocalizations.of(context)!.settingsImportChats,
|
button(AppLocalizations.of(context)!.settingsImportChats,
|
||||||
Icons.download_rounded, () {
|
Icons.download_rounded, () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
@ -106,14 +106,14 @@ class _ScreenSettingsExportState extends State<ScreenSettingsExport> {
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!
|
child: Text(AppLocalizations.of(context)!
|
||||||
.settingsImportChatsCancel)),
|
.settingsImportChatsCancel)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
FilePickerResult? result =
|
FilePickerResult? result =
|
||||||
await FilePicker.platform.pickFiles(
|
await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
import '../worker/haptic.dart';
|
||||||
import '../screen_settings.dart';
|
import '../screen_settings.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
|
||||||
context,
|
context,
|
||||||
AppLocalizations.of(context)!.settingsShowModelTags,
|
AppLocalizations.of(context)!.settingsShowModelTags,
|
||||||
(prefs!.getBool("modelTags") ?? false), (value) {
|
(prefs!.getBool("modelTags") ?? false), (value) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
prefs!.setBool("modelTags", value);
|
prefs!.setBool("modelTags", value);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
|
@ -86,44 +87,10 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
|
||||||
.settingsResetOnModelChange,
|
.settingsResetOnModelChange,
|
||||||
(prefs!.getBool("resetOnModelSelect") ?? true),
|
(prefs!.getBool("resetOnModelSelect") ?? true),
|
||||||
(value) {
|
(value) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
prefs!.setBool("resetOnModelSelect", value);
|
prefs!.setBool("resetOnModelSelect", value);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
titleDivider(),
|
|
||||||
toggle(
|
|
||||||
context,
|
|
||||||
AppLocalizations.of(context)!.settingsGenerateTitles,
|
|
||||||
(prefs!.getBool("generateTitles") ?? true), (value) {
|
|
||||||
HapticFeedback.selectionClick();
|
|
||||||
prefs!.setBool("generateTitles", value);
|
|
||||||
setState(() {});
|
|
||||||
}),
|
|
||||||
toggle(
|
|
||||||
context,
|
|
||||||
AppLocalizations.of(context)!.settingsEnableEditing,
|
|
||||||
(prefs!.getBool("enableEditing") ?? true), (value) {
|
|
||||||
HapticFeedback.selectionClick();
|
|
||||||
prefs!.setBool("enableEditing", value);
|
|
||||||
setState(() {});
|
|
||||||
}),
|
|
||||||
toggle(
|
|
||||||
context,
|
|
||||||
AppLocalizations.of(context)!.settingsAskBeforeDelete,
|
|
||||||
(prefs!.getBool("askBeforeDeletion") ?? false),
|
|
||||||
(value) {
|
|
||||||
HapticFeedback.selectionClick();
|
|
||||||
prefs!.setBool("askBeforeDeletion", value);
|
|
||||||
setState(() {});
|
|
||||||
}),
|
|
||||||
toggle(
|
|
||||||
context,
|
|
||||||
AppLocalizations.of(context)!.settingsShowTips,
|
|
||||||
(prefs!.getBool("tips") ?? true), (value) {
|
|
||||||
HapticFeedback.selectionClick();
|
|
||||||
prefs!.setBool("tips", value);
|
|
||||||
setState(() {});
|
|
||||||
}),
|
|
||||||
titleDivider(bottom: 20),
|
titleDivider(bottom: 20),
|
||||||
SegmentedButton(
|
SegmentedButton(
|
||||||
segments: [
|
segments: [
|
||||||
|
@ -142,12 +109,68 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
|
||||||
prefs!.getString("requestType") ?? "stream"
|
prefs!.getString("requestType") ?? "stream"
|
||||||
},
|
},
|
||||||
onSelectionChanged: (p0) {
|
onSelectionChanged: (p0) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
setState(() {
|
setState(() {
|
||||||
prefs!.setString("requestType", p0.elementAt(0));
|
prefs!.setString("requestType", p0.elementAt(0));
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!.settingsGenerateTitles,
|
||||||
|
(prefs!.getBool("generateTitles") ?? true), (value) {
|
||||||
|
selectionHaptic();
|
||||||
|
prefs!.setBool("generateTitles", value);
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!.settingsEnableEditing,
|
||||||
|
(prefs!.getBool("enableEditing") ?? true), (value) {
|
||||||
|
selectionHaptic();
|
||||||
|
prefs!.setBool("enableEditing", value);
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!.settingsAskBeforeDelete,
|
||||||
|
(prefs!.getBool("askBeforeDeletion") ?? false),
|
||||||
|
(value) {
|
||||||
|
selectionHaptic();
|
||||||
|
prefs!.setBool("askBeforeDeletion", value);
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!.settingsShowTips,
|
||||||
|
(prefs!.getBool("tips") ?? true), (value) {
|
||||||
|
selectionHaptic();
|
||||||
|
prefs!.setBool("tips", value);
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
titleDivider(),
|
||||||
|
toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!
|
||||||
|
.settingsEnableHapticFeedback,
|
||||||
|
(prefs!.getBool("enableHaptic") ?? true), (value) {
|
||||||
|
prefs!.setBool("enableHaptic", value);
|
||||||
|
selectionHaptic();
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)
|
||||||
|
? toggle(
|
||||||
|
context,
|
||||||
|
AppLocalizations.of(context)!
|
||||||
|
.settingsMaximizeOnStart,
|
||||||
|
(prefs!.getBool("maximizeOnStart") ?? false),
|
||||||
|
(value) {
|
||||||
|
selectionHaptic();
|
||||||
|
prefs!.setBool("maximizeOnStart", value);
|
||||||
|
setState(() {});
|
||||||
|
})
|
||||||
|
: const SizedBox.shrink(),
|
||||||
|
const SizedBox(height: 16),
|
||||||
SegmentedButton(
|
SegmentedButton(
|
||||||
segments: [
|
segments: [
|
||||||
ButtonSegment(
|
ButtonSegment(
|
||||||
|
@ -170,7 +193,7 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
|
||||||
prefs!.getString("brightness") ?? "system"
|
prefs!.getString("brightness") ?? "system"
|
||||||
},
|
},
|
||||||
onSelectionChanged: (p0) {
|
onSelectionChanged: (p0) {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
var tmp = prefs!.getString("brightness") ?? "system";
|
var tmp = prefs!.getString("brightness") ?? "system";
|
||||||
prefs!.setString("brightness", p0.elementAt(0));
|
prefs!.setString("brightness", p0.elementAt(0));
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import '../main.dart';
|
||||||
|
|
||||||
|
void lightHaptic() {
|
||||||
|
if (!(prefs!.getBool("enableHaptic") ?? true)) return;
|
||||||
|
HapticFeedback.lightImpact();
|
||||||
|
}
|
||||||
|
|
||||||
|
void mediumHaptic() {
|
||||||
|
if (!(prefs!.getBool("enableHaptic") ?? true)) return;
|
||||||
|
HapticFeedback.mediumImpact();
|
||||||
|
}
|
||||||
|
|
||||||
|
void heavyHaptic() {
|
||||||
|
if (!(prefs!.getBool("enableHaptic") ?? true)) return;
|
||||||
|
HapticFeedback.heavyImpact();
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectionHaptic() {
|
||||||
|
if (!(prefs!.getBool("enableHaptic") ?? true)) return;
|
||||||
|
HapticFeedback.selectionClick();
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'main.dart';
|
import 'haptic.dart';
|
||||||
|
import '../main.dart';
|
||||||
|
|
||||||
import 'package:dartx/dartx.dart';
|
import 'package:dartx/dartx.dart';
|
||||||
import 'package:ollama_dart/ollama_dart.dart' as llama;
|
import 'package:ollama_dart/ollama_dart.dart' as llama;
|
||||||
|
@ -63,7 +63,7 @@ void setModel(BuildContext context, Function setState) {
|
||||||
load();
|
load();
|
||||||
|
|
||||||
if (useModel) return;
|
if (useModel) return;
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
|
|
||||||
var content = StatefulBuilder(builder: (context, setLocalState) {
|
var content = StatefulBuilder(builder: (context, setLocalState) {
|
||||||
setModalState = setLocalState;
|
setModalState = setLocalState;
|
|
@ -2,8 +2,8 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
|
import 'haptic.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
@ -132,14 +132,14 @@ void updateDialog(BuildContext context, Function title) {
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!
|
child: Text(AppLocalizations.of(context)!
|
||||||
.settingsUpdateDialogCancel)),
|
.settingsUpdateDialogCancel)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.selectionClick();
|
selectionHaptic();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
launchUrl(
|
launchUrl(
|
||||||
mode: LaunchMode.inAppBrowserView,
|
mode: LaunchMode.inAppBrowserView,
|
Loading…
Reference in New Issue