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