Improvements
This commit is contained in:
parent
07afba3a29
commit
df4879fe6e
|
@ -71,6 +71,7 @@ final user = types.User(id: const Uuid().v4());
|
|||
final assistant = types.User(id: const Uuid().v4());
|
||||
|
||||
bool settingsOpen = false;
|
||||
bool desktopTitleVisible = true;
|
||||
bool logoVisible = true;
|
||||
bool menuVisible = false;
|
||||
bool sendable = false;
|
||||
|
@ -504,7 +505,7 @@ class _MainAppState extends State<MainApp> {
|
|||
if (chatUuid == jsonDecode(item)["uuid"]) {
|
||||
messages = [];
|
||||
chatUuid = null;
|
||||
if (!desktopLayout(context)) {
|
||||
if (!desktopLayoutRequired(context)) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
|
@ -517,10 +518,11 @@ class _MainAppState extends State<MainApp> {
|
|||
borderRadius: BorderRadius.all(Radius.circular(50))),
|
||||
onTap: () {
|
||||
selectionHaptic();
|
||||
if (!desktopFeature()) {
|
||||
if (!desktopLayoutRequired(context)) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
if (!chatAllowed) return;
|
||||
if (chatUuid == jsonDecode(item)["uuid"]) return;
|
||||
loadChat(jsonDecode(item)["uuid"], setState);
|
||||
chatUuid = jsonDecode(item)["uuid"];
|
||||
},
|
||||
|
@ -671,18 +673,52 @@ class _MainAppState extends State<MainApp> {
|
|||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
title: Row(
|
||||
children: desktopFeature()
|
||||
? desktopLayoutRequired(context)
|
||||
? [
|
||||
SizedBox(width: 85, height: 200, child: MoveWindow()),
|
||||
// bottom left tile
|
||||
SizedBox(
|
||||
width: 304, height: 200, child: MoveWindow()),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: AnimatedOpacity(
|
||||
opacity: menuVisible ? 1.0 : 0.0,
|
||||
duration:
|
||||
const Duration(milliseconds: 300),
|
||||
child: VerticalDivider(
|
||||
width: 2,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface
|
||||
.withAlpha(20)))),
|
||||
AnimatedOpacity(
|
||||
opacity: desktopTitleVisible ? 1.0 : 0.0,
|
||||
duration: desktopTitleVisible
|
||||
? const Duration(milliseconds: 300)
|
||||
: const Duration(milliseconds: 0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: selector,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(height: 200, child: MoveWindow())),
|
||||
child: SizedBox(
|
||||
height: 200, child: MoveWindow()))
|
||||
]
|
||||
: [
|
||||
SizedBox(
|
||||
width: 90, height: 200, child: MoveWindow()),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 200, child: MoveWindow())),
|
||||
selector,
|
||||
Expanded(
|
||||
child: SizedBox(height: 200, child: MoveWindow()))
|
||||
child: SizedBox(
|
||||
height: 200, child: MoveWindow()))
|
||||
]
|
||||
: [Expanded(child: selector)],
|
||||
),
|
||||
: [Expanded(child: selector)]),
|
||||
actions: desktopControlsActions(context, [
|
||||
const SizedBox(width: 4),
|
||||
IconButton(
|
||||
|
@ -786,8 +822,7 @@ class _MainAppState extends State<MainApp> {
|
|||
.onSurface
|
||||
.withAlpha(20)))
|
||||
: const SizedBox.shrink()),
|
||||
leading:
|
||||
desktopLayoutRequired(context) ? const SizedBox() : null),
|
||||
automaticallyImplyLeading: !desktopLayoutRequired(context)),
|
||||
body: Row(
|
||||
children: [
|
||||
desktopLayoutRequired(context)
|
||||
|
|
|
@ -24,6 +24,12 @@ bool desktopLayoutRequired(BuildContext context,
|
|||
return (desktopFeature(web: web) && value >= valueCap);
|
||||
}
|
||||
|
||||
bool desktopLayoutNotRequired(BuildContext context,
|
||||
{bool web = false, double? value, double valueCap = 1000}) {
|
||||
value ??= MediaQuery.of(context).size.width;
|
||||
return (value >= valueCap);
|
||||
}
|
||||
|
||||
Widget desktopControls(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
|
|
|
@ -21,6 +21,8 @@ void setModel(BuildContext context, Function setState) {
|
|||
int addIndex = -1;
|
||||
bool loaded = false;
|
||||
Function? setModalState;
|
||||
desktopTitleVisible = false;
|
||||
setState(() {});
|
||||
void load() async {
|
||||
try {
|
||||
var list = await llama.OllamaClient(
|
||||
|
@ -49,6 +51,9 @@ void setModel(BuildContext context, Function setState) {
|
|||
loaded = true;
|
||||
setModalState!(() {});
|
||||
} catch (_) {
|
||||
setState(() {
|
||||
desktopTitleVisible = true;
|
||||
});
|
||||
// ignore: use_build_context_synchronously
|
||||
Navigator.of(context).pop();
|
||||
// ignore: use_build_context_synchronously
|
||||
|
@ -87,7 +92,9 @@ void setModel(BuildContext context, Function setState) {
|
|||
prefs?.remove("model");
|
||||
}
|
||||
prefs?.setBool("multimodal", multimodal);
|
||||
setState(() {});
|
||||
setState(() {
|
||||
desktopTitleVisible = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: desktopLayout(context) ? null : double.infinity,
|
||||
|
@ -111,7 +118,7 @@ void setModel(BuildContext context, Function setState) {
|
|||
child: Wrap(
|
||||
spacing: desktopLayout(context) ? 10.0 : 5.0,
|
||||
runSpacing: desktopFeature()
|
||||
? desktopLayoutRequired(context)
|
||||
? desktopFeature()
|
||||
? 10.0
|
||||
: 5.0
|
||||
: 0.0,
|
||||
|
@ -217,11 +224,20 @@ void setModel(BuildContext context, Function setState) {
|
|||
])));
|
||||
});
|
||||
|
||||
if (desktopLayout(context)) {
|
||||
if (desktopFeature()) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(alignment: Alignment.topCenter, child: content);
|
||||
return Transform.translate(
|
||||
offset: desktopLayoutRequired(context)
|
||||
? const Offset(289, 0)
|
||||
: const Offset(0, 0),
|
||||
child: Dialog(
|
||||
alignment: desktopLayoutRequired(context)
|
||||
? Alignment.topLeft
|
||||
: Alignment.topCenter,
|
||||
child: content),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
showModalBottomSheet(context: context, builder: (context) => content);
|
||||
|
|
Loading…
Reference in New Issue