improved assistant ux

This commit is contained in:
Fabian Freund
2024-07-01 17:58:27 +02:00
parent 5aad8446bb
commit c1d35a1145
@@ -112,9 +112,21 @@ class AssistantTab extends HookConsumerWidget {
.update(value.first); .update(value.first);
}, },
), ),
const SizedBox(
height: 12,
),
_PromptField(textController, incognitoEnabled),
],
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: 12,
),
_PromptField(textController, incognitoEnabled),
], ],
), ),
const SizedBox.shrink(),
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -138,35 +150,22 @@ class AssistantTab extends HookConsumerWidget {
ref.read(activeChatModelProvider.notifier).update(value!); ref.read(activeChatModelProvider.notifier).update(value!);
}, },
), ),
const SizedBox(
height: 12,
),
_PromptField(textController, incognitoEnabled),
], ],
), ),
const SizedBox.shrink(), Column(
], mainAxisSize: MainAxisSize.min,
), children: [
const SizedBox( const SizedBox(
height: 12, height: 12,
), ),
TextFormField( _PromptField(textController, incognitoEnabled),
controller: textController, ],
enableIMEPersonalizedLearning: !incognitoEnabled,
decoration: InputDecoration(
label: const Text('Prompt'),
hintText: 'Enter your prompt...',
floatingLabelBehavior: FloatingLabelBehavior.always,
suffixIcon: SpeechToTextButton(
onTextReceived: (data) {
textController.text = data.toString();
},
), ),
), ],
maxLines: null,
validator: (value) {
if (value?.isEmpty ?? true) {
return '';
}
return null;
},
), ),
const SizedBox( const SizedBox(
height: 12, height: 12,
@@ -195,3 +194,36 @@ class AssistantTab extends HookConsumerWidget {
); );
} }
} }
class _PromptField extends StatelessWidget {
final TextEditingController textController;
final bool incognitoEnabled;
const _PromptField(this.textController, this.incognitoEnabled);
@override
Widget build(BuildContext context) {
return TextFormField(
controller: textController,
enableIMEPersonalizedLearning: !incognitoEnabled,
decoration: InputDecoration(
label: const Text('Prompt'),
hintText: 'Enter your prompt...',
floatingLabelBehavior: FloatingLabelBehavior.always,
suffixIcon: SpeechToTextButton(
onTextReceived: (data) {
textController.text = data.toString();
},
),
),
maxLines: null,
validator: (value) {
if (value?.isEmpty ?? true) {
return '';
}
return null;
},
);
}
}