From 399f0d9cceed77ccdf64e7875b52f5f575196446 Mon Sep 17 00:00:00 2001 From: JHubi1 Date: Wed, 29 May 2024 11:34:34 +0200 Subject: [PATCH] Added message processing indicator --- lib/main.dart | 79 ++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 84b2029..f29d5b5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -178,43 +178,47 @@ class _MainAppState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: InkWell( - onTap: () { - setModel(context, setState); - }, - splashFactory: NoSplash.splashFactory, - highlightColor: Colors.transparent, - enableFeedback: false, - child: SizedBox( - height: 72, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: Text( - (model ?? - AppLocalizations.of(context)! - .noSelectedModel), - overflow: TextOverflow.fade, - style: const TextStyle( - fontFamily: "monospace", fontSize: 16))), - const SizedBox(width: 4), - useModel - ? const SizedBox.shrink() - : const Icon(Icons.expand_more_rounded) - ]))), - actions: [ - IconButton( - onPressed: () { - HapticFeedback.selectionClick(); - if (!chatAllowed) return; - messages = []; - setState(() {}); + title: InkWell( + onTap: () { + setModel(context, setState); }, - icon: const Icon(Icons.restart_alt_rounded)) - ], - ), + splashFactory: NoSplash.splashFactory, + highlightColor: Colors.transparent, + enableFeedback: false, + child: SizedBox( + height: 72, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: Text( + (model ?? + AppLocalizations.of(context)! + .noSelectedModel), + overflow: TextOverflow.fade, + style: const TextStyle( + fontFamily: "monospace", fontSize: 16))), + const SizedBox(width: 4), + useModel + ? const SizedBox.shrink() + : const Icon(Icons.expand_more_rounded) + ]))), + actions: [ + IconButton( + onPressed: () { + HapticFeedback.selectionClick(); + if (!chatAllowed) return; + messages = []; + setState(() {}); + }, + icon: const Icon(Icons.restart_alt_rounded)) + ], + bottom: PreferredSize( + preferredSize: const Size.fromHeight(1), + child: (!chatAllowed && model != null) + ? const LinearProgressIndicator() + : const SizedBox.shrink())), body: SizedBox.expand( child: Chat( messages: messages, @@ -478,8 +482,7 @@ class _MainAppState extends State { ? 0 : 8)) : DarkChatTheme( - backgroundColor: - (themeDark ?? ThemeData.dark()).colorScheme.surface, + backgroundColor: (themeDark ?? ThemeData.dark()).colorScheme.surface, primaryColor: (themeDark ?? ThemeData.dark()).colorScheme.primary.withAlpha(40), attachmentButtonIcon: const Icon(Icons.add_a_photo_rounded), sendButtonIcon: const Icon(Icons.send_rounded),