Tried fixes for #26
This commit is contained in:
parent
0086ec63bc
commit
fcb20e7931
114
lib/main.dart
114
lib/main.dart
|
@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'screen_settings.dart';
|
||||
import 'screen_voice.dart';
|
||||
|
@ -34,6 +33,7 @@ import 'package:speech_to_text/speech_to_text.dart';
|
|||
import 'package:flutter_tts/flutter_tts.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
// client configuration
|
||||
|
||||
|
@ -881,6 +881,13 @@ class _MainAppState extends State<MainApp> {
|
|||
right: 23,
|
||||
top: 17,
|
||||
bottom: 17),
|
||||
child: Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
scrollbarTheme:
|
||||
const ScrollbarThemeData(
|
||||
thumbColor:
|
||||
WidgetStatePropertyAll(
|
||||
Colors.grey))),
|
||||
child: MarkdownBody(
|
||||
data: p0.text,
|
||||
onTapLink: (text, href, title) async {
|
||||
|
@ -919,9 +926,46 @@ class _MainAppState extends State<MainApp> {
|
|||
),
|
||||
imageBuilder: (uri, title, alt) {
|
||||
if (uri.isAbsolute) {
|
||||
return Image.network(uri.toString(),
|
||||
errorBuilder: (context, error,
|
||||
return Image.network(
|
||||
uri.toString(), errorBuilder:
|
||||
(context, error,
|
||||
stackTrace) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
selectionHaptic();
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.notAValidImage),
|
||||
showCloseIcon:
|
||||
true));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
color: Theme.of(context)
|
||||
.brightness ==
|
||||
Brightness
|
||||
.light
|
||||
? Colors.white
|
||||
: Colors.black),
|
||||
padding:
|
||||
const EdgeInsets
|
||||
.only(
|
||||
left: 100,
|
||||
right: 100,
|
||||
top: 32),
|
||||
child: const Image(
|
||||
image: AssetImage(
|
||||
"assets/logo512error.png"))));
|
||||
});
|
||||
} else {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
selectionHaptic();
|
||||
|
@ -954,37 +998,6 @@ class _MainAppState extends State<MainApp> {
|
|||
child: const Image(
|
||||
image: AssetImage(
|
||||
"assets/logo512error.png"))));
|
||||
});
|
||||
} else {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
selectionHaptic();
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.notAValidImage),
|
||||
showCloseIcon: true));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
color: Theme.of(context)
|
||||
.brightness ==
|
||||
Brightness.light
|
||||
? Colors.white
|
||||
: Colors.black),
|
||||
padding:
|
||||
const EdgeInsets.only(
|
||||
left: 100,
|
||||
right: 100,
|
||||
top: 32),
|
||||
child: const Image(
|
||||
image: AssetImage(
|
||||
"assets/logo512error.png"))));
|
||||
}
|
||||
},
|
||||
styleSheet: (p0.author == user)
|
||||
|
@ -998,7 +1011,8 @@ class _MainAppState extends State<MainApp> {
|
|||
BoxDecoration(
|
||||
color: Colors.grey[800],
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
code: const TextStyle(
|
||||
color: Colors.black,
|
||||
|
@ -1006,7 +1020,8 @@ class _MainAppState extends State<MainApp> {
|
|||
Colors.white),
|
||||
codeblockDecoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8)),
|
||||
h1: white,
|
||||
h2: white,
|
||||
|
@ -1015,8 +1030,7 @@ class _MainAppState extends State<MainApp> {
|
|||
h5: white,
|
||||
h6: white,
|
||||
listBullet: white,
|
||||
horizontalRuleDecoration:
|
||||
BoxDecoration(
|
||||
horizontalRuleDecoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Colors
|
||||
|
@ -1037,25 +1051,28 @@ class _MainAppState extends State<MainApp> {
|
|||
BoxDecoration(
|
||||
color: Colors.grey[200],
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
code: const TextStyle(
|
||||
color: Colors.white,
|
||||
backgroundColor: Colors.black),
|
||||
backgroundColor:
|
||||
Colors.black),
|
||||
codeblockDecoration: BoxDecoration(color: Colors.black, borderRadius: BorderRadius.circular(8)),
|
||||
horizontalRuleDecoration: BoxDecoration(border: Border(top: BorderSide(color: Colors.grey[200]!, width: 1))))
|
||||
: MarkdownStyleSheet(
|
||||
p: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
|
||||
blockquoteDecoration: BoxDecoration(
|
||||
color: Colors.grey[800]!,
|
||||
color:
|
||||
Colors.grey[800]!,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
code: const TextStyle(color: Colors.black, backgroundColor: Colors.white),
|
||||
codeblockDecoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
horizontalRuleDecoration: BoxDecoration(border: Border(top: BorderSide(color: Colors.grey[200]!, width: 1))))));
|
||||
horizontalRuleDecoration: BoxDecoration(border: Border(top: BorderSide(color: Colors.grey[200]!, width: 1))))),
|
||||
));
|
||||
},
|
||||
imageMessageBuilder: (p0,
|
||||
{required messageWidth}) {
|
||||
|
@ -1515,8 +1532,11 @@ class _MainAppState extends State<MainApp> {
|
|||
),
|
||||
],
|
||||
),
|
||||
drawerEdgeDragWidth:
|
||||
desktopLayout(context) ? null : MediaQuery.of(context).size.width,
|
||||
drawerEdgeDragWidth: (prefs!.getBool("fixCodeblockScroll") ?? false)
|
||||
? null
|
||||
: (desktopLayout(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width),
|
||||
drawer: Builder(builder: (context) {
|
||||
if (desktopLayoutRequired(context) && !settingsOpen) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||
import 'package:restart_app/restart_app.dart';
|
||||
import 'package:duration_picker/duration_picker.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ScreenSettingsInterface extends StatefulWidget {
|
||||
const ScreenSettingsInterface({super.key});
|
||||
|
@ -404,6 +405,21 @@ class _ScreenSettingsInterfaceState extends State<ScreenSettingsInterface> {
|
|||
});
|
||||
});
|
||||
}),
|
||||
titleDivider(),
|
||||
toggle(context, "Fix to code block not scrollable",
|
||||
(prefs!.getBool("fixCodeblockScroll") ?? false),
|
||||
(value) {
|
||||
prefs!.setBool("fixCodeblockScroll", value);
|
||||
if ((prefs!.getBool("fixCodeblockScroll") ?? false) ==
|
||||
false) {
|
||||
prefs!.remove("fixCodeblockScroll");
|
||||
}
|
||||
selectionHaptic();
|
||||
setState(() {});
|
||||
}, onLongTap: () {
|
||||
launchUrl(Uri.parse(
|
||||
"https://github.com/JHubi1/ollama-app/issues/26"));
|
||||
}),
|
||||
const SizedBox(height: 16)
|
||||
]),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue