fix: On-screen keyboard overlaps input fields in AI Request Prompt on Android#1385
fix: On-screen keyboard overlaps input fields in AI Request Prompt on Android#1385Harshul23 wants to merge 2 commits intofoss42:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Android UI/UX issues in the AI Request Prompt editor by making the prompt fields scrollable when the on-screen keyboard appears, and tweaks the Learn button padding to visually center the icon.
Changes:
- Refactors
AIRequestPromptSectionlayout from a non-scrollableColumn+Expandedto aLayoutBuilder+ListViewapproach to prevent keyboard overlap. - Adjusts
LearnButton’sButtonStyle.paddingto use horizontal symmetric padding for improved icon alignment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/screens/home_page/editor_pane/details_card/request_pane/ai_request/aireq_prompt.dart | Reworks prompt editor layout to be scrollable and responsive to reduced vertical space (e.g., when keyboard opens). |
| lib/widgets/button_learn.dart | Updates button padding to improve icon centering/visual alignment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| child: Container( | ||
| return LayoutBuilder( | ||
| builder: (context, constraints) { | ||
| final fieldHeight = (constraints.maxHeight - 100)*3/4; |
There was a problem hiding this comment.
fieldHeight can become zero/negative when available height is small (e.g., landscape / split-screen / when the keyboard reduces the pane height). Since TextFieldEditor uses TextFormField(expands: true), a non-positive height here can trigger layout assertions. Consider clamping to a reasonable minimum (> 0) and deriving the height from actual remaining space (e.g., based on known header/spacer heights, or splitting available height between the two editors) instead of using the magic - 100 and * 3/4 constants.
| final fieldHeight = (constraints.maxHeight - 100)*3/4; | |
| const minFieldHeight = 80.0; | |
| final availableHeight = constraints.maxHeight; | |
| double fieldHeight; | |
| if (availableHeight.isFinite && availableHeight > 0) { | |
| // Approximate space used by labels, spacers, and padding. | |
| const reservedForChrome = 140.0; | |
| final remaining = | |
| (availableHeight - reservedForChrome).clamp(0.0, availableHeight); | |
| final perField = remaining / 2; | |
| fieldHeight = perField.clamp(minFieldHeight, availableHeight); | |
| } else { | |
| fieldHeight = minFieldHeight; | |
| } |
PR Description
Fix: Keyboard overlap on AI Request Prompt fields and correct the alignment of icon inside Learn Button.
This PR addresses two UI/UX improvements.
The Problem: On Android devices, the on-screen keyboard obscured the "System Prompt" and "User Prompt" fields, preventing users from seeing what they were typing.
The Fix: Refactored
aireq_prompt.dartby replacing the staticColumn+Expandedlayout with aLayoutBuilderandListView. This allows the view to dynamically scroll when the keyboard appears, keeping the focused field visible.Screenrecorder-2026-03-20-14-50-46-52.mp4
The Problem: The '?' icon was visually off-center due to inconsistent padding.
The Fix: Updated
button_learn.dartto useEdgeInsets.symmetric(horizontal: 10), ensuring the icon is perfectly centered within its container.BeforeAfterFlutter Doctor
Related Issues
Closes #1381
Checklist
mainbranch before making this PRflutter upgradeand verify)flutter test) and all tests are passingAdded/updated tests?
OS on which you have developed and tested the feature?