- Notifications
You must be signed in to change notification settings - Fork 129
Fix the expanded TextField #146
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @lethargicpanda, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a layout issue in several AI sample applications where interactive elements positioned next to multi-line text input fields failed to resize appropriately when the text field expanded. The changes ensure that these companion buttons now dynamically adjust their height to match the text input, providing a more consistent and responsive user interface across the affected screens. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request aims to fix an issue where the TextField does not expand vertically for multiline input. The approach of using Modifier.height(IntrinsicSize.Min) on the container Row and Modifier.fillMaxHeight() on the adjacent buttons is correct.
However, there are a few issues with the current implementation:
-
Critical Flaw: The custom
GenerateButtonandSecondaryButtoncomponents have hardcodedheight()modifiers within their implementation inui-component/src/main/java/com/android/ai/uicomponent/Buttons.kt. This overrides thefillMaxHeight()modifier applied in this PR, preventing the buttons from resizing vertically with theTextField. This makes the intended fix ineffective. The hardcoded heights must be removed fromButtons.ktfor this PR to work as expected. -
Inconsistent Updates: In some sample screens, not all buttons within the
TextInputhave been updated. Specifically:- In
samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreen.kt, theSecondaryButtonstill has a fixed height. - In
samples/gemini-multimodal/src/main/java/com/android/ai/samples/geminimultimodal/ui/GeminiMultimodalScreen.kt, theSecondaryButtonalso retains a fixed height.
- In
-
Fixed Height on
TextInput: Insamples/magic-selfie/src/main/java/com/android/ai/samples/magicselfie/ui/MagicSelfieScreen.kt, theTextInputcomponent itself is constrained to a fixedheight(80.dp). This will prevent it from expanding, defeating the purpose of the intrinsic sizing. This fixed height should be removed.
I've added a specific comment highlighting the critical flaw. The other points should also be addressed to fully resolve the issue.
| } | ||
| GenerateButton( | ||
| modifier = Modifier | ||
| .height(56.dp) |
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.
why is this one hard-coded and not fillMaxHeight?
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.
It's intentional to keep the maintain the height of the button. After checking the design it should actually be 96dp, I am increasing it.
Fix the expanded
TextField