Skip to content

[android] Textfield text selection handlers get covered by keyboard #120551

Description

@delfme

Text selection handler is cut by the keyboard.

Tested on latest stable and master 3.8.0-5.0.pre.1, android 12SKQ1.211006.001, xiaomi mi lite 11 5G.

Steps to Reproduce

Please run this example here:

import 'package:flutter/material.dart';


void main() {
  runApp(MyApp(
    items: List<String>.generate(100, (i) => 'Item $i'),
  ));
}

class MyApp extends StatelessWidget {
  final List<String> items;
  MyApp({super.key, required this.items});
  final _messageController = TextEditingController();

  final _focusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Text Selection Handlers Issue'),
        ),
        body: Center(

          child: Padding(
            padding: EdgeInsets.fromLTRB(40, 0, 40, 0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.center,
              children:  <Widget>[
                Expanded(

                  child:
                  ListView.builder(
                    itemCount: items.length,
                    prototypeItem: ListTile(
                      title:Text(items.first),
                    ),
                    itemBuilder: (context, index) {
                      return ListTile(
                        title:
                        ColoredBox(
                          color: Colors.greenAccent,
                          child:
                          Container(
                             child:Text(items[index]),
                             height: 45,
                          )
                        )
                      );
                    },
                  ),
                ),

                //Textfield Widget
                const Text('Texfield:'),
                SizedBox(height: 8),
                TextFormField(
                  controller: _messageController,
                  minLines: 1,
                  maxLines: 12,
                  keyboardType: TextInputType.multiline,
                  textCapitalization:
                  TextCapitalization.sentences,
                  focusNode: _focusNode,
                  onTap: () {},
                  decoration: InputDecoration(
                    border: InputBorder.none,
                    isDense: true,
                    hintText: "Message",
                  ),
                ),

              ],
            ),
          ),
        ),
      ),
    );
  }
}

Expected results:
Text selection handler should be rendered on top of keyboard.

Actual results:
Text selection handler is cut by keyboard.

Flutter doctor:

[✓] Flutter (Channel master, 3.8.0-5.0.pre.1, on macOS 12.2 21D49 darwin-arm64, locale en-IT)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsfound in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions