Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textSelectionHandleColor is not working/changing. #20219

Closed
callmenoodles opened this issue Aug 4, 2018 · 6 comments
Closed

textSelectionHandleColor is not working/changing. #20219

callmenoodles opened this issue Aug 4, 2018 · 6 comments
Labels
a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Comments

@callmenoodles
Copy link

callmenoodles commented Aug 4, 2018

It seems so that textSelectionHandleColor is not working and keeps having the default blue color (on Android) when I try to change the color inside ThemeData while for example textSelectionColor does work, so the problem cannot be the position of the widget. So I believe this is an actual bug.

Code

return new Container(
    child: Theme(
      data: ThemeData(
        primaryColor: Colors.white,
        hintColor: Colors.grey,
        textSelectionColor: Colors.grey,
        textSelectionHandleColor: Colors.grey,
      ),
      child: EnsureVisibleWhenFocused(
        focusNode: focusNode,
        child: Padding(
          padding: const EdgeInsets.only(bottom: 10.0),
          child: TextFormField(
            focusNode: focusNode,
            decoration: InputDecoration(
              labelText: text,
              labelStyle: TextStyle(
                color: Colors.grey,
              ),
            ),
            keyboardType: type,
            obscureText: obscureText,
            style: TextStyle(
              color: Colors.white,
            ),
            validator: validator,
            autovalidate: autovalidate,
            onSaved: onSaved,
          ),
        ),
      ),
    ),
  );

flutter doctor

[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.17134.228], locale en-US)
    • Flutter version 0.5.1 at C:\Flutter\flutter
    • Framework revision c7ea3ca377 (3 months ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\alexl\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 27.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 27.1.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[!] VS Code, 64-bit edition (version 1.26.0)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

! Doctor found issues in 1 category.

I'm using Android Studio, so don't worry about the VS Code issue.

@zoechi
Copy link
Contributor

zoechi commented Aug 24, 2018

Please add the output of flutter doctor -v.

@zoechi zoechi added the a: text input Entering text in a text field or keyboard related problems label Aug 24, 2018
@slightfoot
Copy link
Member

Same problem on v0.5.7. Occur's because the context passed to TextSelectionControls.buildHandle() is from the OverlayEntry's builder. So it's parent is the Navigator and thus MaterialApp. So the textSelectionHandleColor theme field can only be overridden in the ThemeData supplied to MaterialApp and not the parent of the TextFormField/TextField/EditableText.

@zoechi zoechi added this to the Goals milestone Aug 24, 2018
@zoechi zoechi added the framework flutter/packages/flutter repository. See also f: labels. label Aug 29, 2018
@goderbauer goderbauer added the f: material design flutter/packages/flutter/material repository. label Jan 3, 2019
@jaumard
Copy link
Contributor

jaumard commented May 29, 2019

Is it really fixed ? I've set the field but it stay blue... Same for cursorColor

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale fr-FR)
    • Flutter version 1.5.4-hotfix.2 at /Users/jaumard/flutter
    • Framework revision 7a4c33425d (4 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

@phoenixsky
Copy link

@jaumard in ios platform ,when you want change the cursorColor ,you can override cupertinoOverrideTheme in themedata .

but textSelectionHandleColor . I don't know yet

@knissophiliac
Copy link

knissophiliac commented Apr 4, 2020

Thanks to @phoenixsky comment, I tried

ThemeData( cupertinoOverrideTheme: CupertinoThemeData( primaryColor: Colors.red, ), cursorColor: Colors.red, )

It changed both cursorColor and textSelectionHandleColor.

@lock
Copy link

lock bot commented Apr 18, 2020

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.

@lock lock bot locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants