Skip to content

fix: On-screen keyboard overlaps input fields in AI Request Prompt on Android#1385

Open
Harshul23 wants to merge 2 commits intofoss42:mainfrom
Harshul23:fix/android-keyboard-overlap
Open

fix: On-screen keyboard overlaps input fields in AI Request Prompt on Android#1385
Harshul23 wants to merge 2 commits intofoss42:mainfrom
Harshul23:fix/android-keyboard-overlap

Conversation

@Harshul23
Copy link

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.

  1. Resolved Keyboard Overlap (Android):

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.dart by replacing the static Column + Expanded layout with a LayoutBuilder and ListView. 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
  1. Learn Button Visual Alignment:

The Problem: The '?' icon was visually off-center due to inconsistent padding.

The Fix: Updated button_learn.dart to use EdgeInsets.symmetric(horizontal: 10), ensuring the icon is perfectly centered within its container.

Before

      

After
image

Flutter Doctor

flutter doctor -v
[✓] Flutter (Channel stable, 3.41.5, on macOS 26.3.1 25D2128 darwin-arm64, locale en-IN) [199ms]
    • Flutter version 3.41.5 on channel stable at /opt/homebrew/share/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2c9eb20739 (2 days ago), 2026-03-17 16:14:01 -0700
    • Engine revision 052f31d115
    • Dart version 3.11.3
    • DevTools version 2.54.2
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop,
      enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file,
      enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [806ms]
    • Android SDK at /Users/harshul/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.17+0)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 26.1.1) [285ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17B100
    ✗ Unable to get list of installed Simulator runtimes.
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation

[✓] Chrome - develop for the web [3ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [5.8s]
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 26.3.1 25D2128 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 146.0.7680.80
    ! Device adb-HYYL7LI7YHVCZPMB-vCMMLr._adb-tls-connect._tcp is offline.

[✓] Network resources [438ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.


Related Issues

Closes #1381

Checklist

Added/updated tests?

  • Yes
  • No, and this is why: This PR focuses on UI layout adjustments and visual styling. Manual verification was performed on Android (API 34) and macOS to ensure the scrolling behavior and icon alignment are correct.

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

Copilot AI review requested due to automatic review settings March 20, 2026 11:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AIRequestPromptSection layout from a non-scrollable Column + Expanded to a LayoutBuilder + ListView approach to prevent keyboard overlap.
  • Adjusts LearnButton’s ButtonStyle.padding to 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;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On-screen keyboard overlaps input fields on Android

2 participants