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

TextField's hint text looks wrong when using flutter_localizations #42393

Closed
giantsol opened this issue Oct 10, 2019 · 2 comments
Closed

TextField's hint text looks wrong when using flutter_localizations #42393

giantsol opened this issue Oct 10, 2019 · 2 comments

Comments

@giantsol
Copy link
Contributor

Hi!
I've been having trouble with TextField's hint text looking weird like below:

image

You see, hint text is displayed a little bit off to the bottom (overlapping with underline), and when I turn on Debug Paint it looks like this:

image

It looks like TextField's rect and hint text's rect are not in the same position, and that's why hint text is displayed a little bit off.

As far as I found out, flutter_localizations looks like the cause. I'm setting supportedLocales to 'en' and 'ko' (which stands for Korean), and when I remove 'ko', this problem disappears.

Steps to Reproduce

First add flutter_localizations dependency as below in pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

Below is the code to reproduce this problem:

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Bug reporting',
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
      ],
      supportedLocales: [
        const Locale('en'),
        const Locale('ko'),
      ],
      home: Scaffold(
        appBar: AppBar(
          title: Text('AppBar'),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            SizedBox(
              height: 50,
              child: TextField(
                decoration: InputDecoration(
                  contentPadding: EdgeInsets.all(0),
                  hintText: '안녕 세계', // Korean
                  hintStyle: TextStyle(
                    fontSize: 14,
                  )
                ),
              ),
            ),
            SizedBox(
              height: 100,
              child: TextField(
                decoration: InputDecoration(
                  contentPadding: EdgeInsets.all(0),
                  hintText: 'Hello World',
                  hintStyle: TextStyle(
                    fontSize: 14,
                    color: Colors.black54,
                  )
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Then, when you remove const Locale('ko') from supportedLocales and run again, hint text does not overlap with the underline.

Target Platform: Android
Target OS version/browser: Android 9.0
Devices: Samsung Galaxy S8 (real device)

I only have Android, so I haven't tested it with iOS.
This happens both on Flutter stable channel and master channel (v1.10.15-pre.43).

Logs

No suspicious log output with `flutter run --verbose`
$flutter analyze
Analyzing bug_reporting...
No issues found! (ran in 2.7s)
$flutter doctor -v
[✓] Flutter (Channel master, v1.10.15-pre.43, on Mac OS X 10.14.5 18F132, locale en-KR)
    • Flutter version 1.10.15-pre.43 at /Users/kakao/flutter
    • Framework revision 7de0e1cb01 (66 minutes ago), 2019-10-09 22:45:43 -0400
    • Engine revision eb7abf28e4
    • Dart version 2.6.0 (build 2.6.0-dev.0.0 2ffdc54d24)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/kakao/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2018.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] IntelliJ IDEA Community Edition (version 2018.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] Connected device (2 available)
    • SM G950N • ce10171a80a04f3d02 • android-arm64 • Android 9 (API 28)
    • macOS    • macOS              • darwin-x64    • Mac OS X 10.14.5 18F132

! Doctor found issues in 2 categories.

Please let me know if you need more information.
Thanks :)

@giantsol
Copy link
Contributor Author

Oh~ I just saw same issue with this.. forgot to search for similar issue first.
Closing on my own!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant