flutter-form-builder-ecosystem/flutter_form_builder

[FormBuilderDropdown]: wrong alignment when using flutter sdk 3.22.0

VinhNgT opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

9.2.1

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

Flutter doctor
[✓] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.22631.3593], locale en-US)
    • Flutter version 3.22.0 on channel stable at F:\libs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (2 weeks ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\victo\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Zulu\zulu-17\bin\java
    • Java version OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
    • All Android licenses accepted.

[✓] Android Studio (version 2023.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.10+0--11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at C:\Users\victo\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.88.0

[✓] Connected device (1 available)
    • Redmi Note 8 (mobile) • 139ed888 • android-arm64 • Android 13 (API 33)

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

• No issues found!

Minimal code example

Code sample
FormBuilderDropdown<String>(
  name: 'hello_world',
  autovalidateMode: AutovalidateMode.onUserInteraction,
  decoration: const InputDecoration(
    hintText: 'Hello world',
    suffixIcon: Icon(
      Symbols.expand_more,
    ),
  ),
  icon: const SizedBox.shrink(),
  items: const [
    DropdownMenuItem(
      value: '1',
      child: Text('Option 1'),
    ),
    DropdownMenuItem(
      value: '2',
      child: Text('Option 2'),
    ),
  ],
),

Current Behavior

The hint text alignment of FormBuilderDropdown is wrong in Flutter SDK 3.22.0:

sdk_3 22 0

Expected Behavior

Downgrade to Flutter SDK 3.19.6 fixed the issue

sdk_3 19 6

Steps To Reproduce

Upgrade Flutter SDK to 3.22.0

Aditional information

No response

Hi!
Can test with original Flutter dropdown to know if the bug is the same?
Maybe had some issue related https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+DropdownButtonFormField+hintText

It seems that it's the problem of Flutter itself:
flutter/flutter#148532

I will investigate tomorrow since it's getting late where i live.

Yep, confirmed to be from Flutter:

DropdownButtonFormField(
  decoration: const InputDecoration(
    hintText: 'Language',
    alignLabelWithHint: false,
  ),
  items: const [
    DropdownMenuItem(
      value: 'vi',
      child: Text('Tiếng Việt'),
    ),
    DropdownMenuItem(
      value: 'en',
      child: Text('English'),
    ),
  ],
  icon: const Icon(
    Icons.keyboard_arrow_down_rounded,
  ),
  onChanged: (value) {},
),

flutter_stock