-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Gemini sample #2846
Update Gemini sample #2846
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for incorporating these updates. A few minor considerations, but looks good to me.
) | ||
: ListView( | ||
children: const [ | ||
Text('No API key found. Please provide an API Key.'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good point to add this, since I think the login(?) page currently allows empty submissions.
We don't have a back button, so maybe we should say to restart the sample? However, it's hopefully a rare mistake, so it might be fine to not provide special details or handling to avoid diverging too much from the original sample.
@@ -308,7 +337,10 @@ class MessageWidget extends StatelessWidget { | |||
horizontal: 20, | |||
), | |||
margin: const EdgeInsets.only(bottom: 8), | |||
child: MarkdownBody(data: text), | |||
child: MarkdownBody( | |||
selectable: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo, I was wanting this yesterday! Nice that the package makes it so easy :)
controller: _scrollController, | ||
itemBuilder: (context, idx) { | ||
final content = history[idx]; | ||
final text = content.parts | ||
var content = _chat.history.toList()[idx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a note, I changed this piece intentionally to avoid recreating the same list, and potentially reevaluating the history
iterable for each item, but I'll open an upstream fix so it's not lost.
@@ -157,19 +159,40 @@ class _ChatWidgetState extends State<ChatWidget> { | |||
|
|||
@override | |||
Widget build(BuildContext context) { | |||
final history = _chat.history.toList(); | |||
var textFieldDecoration = InputDecoration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same as the textFieldDecoration
method you added below to share with the API screen? Do you want to keep sharing that implementation or nah?
This applies code changes from this PR: google-gemini/generative-ai-dart#69
cc: @khanhnwin