Skip to content

Cut/Copy/Paste buttons for CupertinoTextField do not respect SafeArea #25632

Closed

Description

@redbrogdon

Steps to Reproduce

I have this code in an otherwise empty project:

import 'package:flutter/cupertino.dart';

void main() {
  runApp(CupertinoApp(
    home: SafeArea(
      child: Column(
        children: [
          SearchBar(),
          Expanded(
            child: Container(),
          ),
        ],
      ),
    ),
  ));
}

class SearchBar extends StatelessWidget {
  final TextEditingController controller;
  final FocusNode focusNode;

  SearchBar({
    @required this.controller,
    @required this.focusNode,
  });

  @override
  Widget build(BuildContext context) {
    return DecoratedBox(
      decoration: BoxDecoration(
        color: CupertinoColors.lightBackgroundGray,
        borderRadius: BorderRadius.circular(10.0),
      ),
      child: Padding(
        padding: const EdgeInsets.symmetric(
          horizontal: 4.0,
          vertical: 8.0,
        ),
        child: Row(
          children: [
            Icon(
              CupertinoIcons.search,
              color: Color(0xff808080),
            ),
            Expanded(
              child: CupertinoTextField(
                controller: controller,
                focusNode: focusNode,
                cursorColor: CupertinoColors.activeBlue,
              ),
            ),
            GestureDetector(
              onTap: () {
                controller.clear();
              },
              child: Icon(
                CupertinoIcons.clear_thick_circled,
                color: Color(0xff000000),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
  1. Start app on a device with a notch (I used an XS Max sim).
  2. Tap into the text field.
  3. Add a bunch of random characters.
  4. Double-tap on the string of characters to highlight a selection.
  5. Notice that the cut/copy/paste tooltips are obscured by the notch.

image

Logs

 $ flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G3025, locale en-US)
    • Flutter version 1.0.0 at /Users/redbrogdon/Library/flutter
    • Framework revision 5391447fae (3 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/redbrogdon/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /Users/redbrogdon/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 27.1.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 31.1.4
    • Dart plugin version 183.4733

[✓] Connected device (1 available)
    • iPhone XS Max • 33CDC891-E0C9-4EA2-AB0C-D7D0DACB0834 • ios • iOS 12.0 (simulator)

• No issues found!

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: cupertino_uicupertino_ui package in flutter/packages
    on Dec 21, 2018
  2. added this to the milestone on Dec 21, 2018
  3. xster commented on Jan 4, 2019

    @xster
    Member

    Since it's technically the same solution, I'm gonna dupe into #3945

  4. github-actions commented on Aug 14, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions