Skip to content

Dragging the collapsed cursor doesn't match native #118268

@justinmc

Description

@justinmc

When dragging the collapsed cursor in a text field on Android and iOS, 1. the loupe does not appear and 2. edge scrolling doesn't work. This is referring to dragging the cursor itself, not dragging the collapsed selection handle (which does work on Android and doesn't exist on iOS).

Scenario Dragging the collapsed handle Dragging the cursor
Flutter on Android android_handle android_cursor
Flutter on iOS n/a ios_drag

Steps to reproduce

  1. Run any app with multiple lines of editable text, such as the one given below.
  2. Tap to place the cursor.
  3. Perform a drag gesture on the cursor.

Expected: The cursor follows the drag, the loupe appears, and edge scrolling works.
Actual: The cursor does follow the drag, but the loupe doesn't appear, and scrolling off the edge causes the cursor to stop following the drag instead of scrolling.

Repro code
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _controller = TextEditingController(
    text: 'Lorem ipsum dolor sit amet,\nconsetetur sadipscing elitr,\nsed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\nsed diam voluptua.\nAt vero eos et accusam et justo duo dolores et ea rebum.\nStet clita kasd gubergren,\nno sea takimata sanctus est Lorem ipsum dolor sit amet.',
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
              controller: _controller,
              minLines: 4,
              maxLines: 4,
            ),
          ],
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions