8000 Text selection toolbar is affected by TextField transformations · Issue #158263 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Text selection toolbar is affected by TextField transformations #158263
Open
@PrimaryFeather

Description

@PrimaryFeather

Steps to reproduce

  1. Create a TextField widget in a Flutter app.
  2. Wrap it with a Transform widget (e.g. to scale or rotate the widget).

The use case here is a drawing app that allows users to transform (scale & rotate) boxes with text and provides WYSIWYG input on the TextFields, regardless of where they are placed and how they are transformed.

Expected results

  • The text selection toolbar should always be sized in screen coordinates, i.e. always have the same size, regardless of the transformation of the TextField.
  • The text selection toolbar should always be drawn parallel to the screen's x-axis (i.e. perfectly horizontal), regardless of the transformation of the TextField.

Besides,

  • Text selection should still work correctly.

Actual results

  • The text selection toolbar scales and rotates with the TextField, i.e. it will potentially be drawn too big / small or rotated.
  • Only parts of the TextField respond to tap events on a rotated TextField.

Code sample

Code sample
import 'dart:math';

import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ConstrainedBox(
            constraints: const BoxConstraints(maxWidth: 300),
            child: Transform.rotate(
              angle: pi / 8.0,
              child: const TextField(),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

scaled-textfield

rotated-textfield

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.4, on macOS 15.1 24B83 darwin-arm64, locale en-US)
    • Flutter version 3.24.4 on channel stable at /Users/redge/Shared/SDKs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (13 days ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/redge/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.1

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

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.95.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.101.20241031

[✓] Connected device (6 available)
    • Daniels iPad Air (mobile)           • 00008112-000108C13E81A01E            • ios            • iOS 18.1 22B83
    • iPhone Mini Daniel (mobile)         • 00008110-001C410C2112401E            • ios            • iOS 18.1 22B83
    • iPhone SE (3rd generation) (mobile) • 60B82120-7A81-4EFD-84E1-594FA2FA296D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 15.1 24B83 darwin-arm64
    • Mac Designed for iPad (desktop)     • mac-designed-for-ipad                • darwin         • macOS 15.1 24B83 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 130.0.6723.93

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

• No issues found!

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 problemsf: material designflutter/packages/flutter/material repository.found in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0