make model selection visible when setting is selected.

This commit is contained in:
2025-01-28 14:00:00 +02:00
parent 1a2d93c202
commit 9a80a610b0

View File

@@ -26,6 +26,7 @@ class AiChat extends StatefulWidget {
class _AiChatState extends State<AiChat> { class _AiChatState extends State<AiChat> {
TextEditingController _modelCopntroller = TextEditingController(); TextEditingController _modelCopntroller = TextEditingController();
final ValueNotifier<bool> _showModelOptions = ValueNotifier(false);
List<types.Message> _messages = []; List<types.Message> _messages = [];
late types.User _user; late types.User _user;
late types.User _mihAI; late types.User _mihAI;
@@ -206,8 +207,22 @@ class _AiChatState extends State<AiChat> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
IconButton(
onPressed: () {
if (_showModelOptions.value == true) {
setState(() {
_showModelOptions.value = false;
});
} else {
setState(() {
_showModelOptions.value = true;
});
}
},
icon: const Icon(Icons.settings),
),
Text( Text(
"Chat with AI", "Chat with Mzansi AI",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
@@ -224,23 +239,31 @@ class _AiChatState extends State<AiChat> {
), ),
], ],
), ),
Row( ValueListenableBuilder(
mainAxisAlignment: MainAxisAlignment.start, valueListenable: _showModelOptions,
children: [ builder: (BuildContext context, bool value, Widget? child) {
Padding( return Visibility(
padding: const EdgeInsets.symmetric(horizontal: 25), visible: value,
child: SizedBox( child: Row(
width: 300, mainAxisAlignment: MainAxisAlignment.start,
child: MIHDropdownField( children: [
controller: _modelCopntroller, Padding(
hintText: "AI Model", padding: const EdgeInsets.symmetric(horizontal: 25),
dropdownOptions: const ['deepseek-r1:1.5b'], child: SizedBox(
required: true, width: 300,
editable: true, child: MIHDropdownField(
), controller: _modelCopntroller,
hintText: "AI Model",
dropdownOptions: const ['deepseek-r1:1.5b'],
required: true,
editable: true,
),
),
)
],
), ),
) );
], },
), ),
Expanded( Expanded(
child: Chat( child: Chat(