Closed pongloongyeat closed 2 months ago
Hi @pongloongyeat
You can use the supported DropdownButtonFormField's hint
property as below sample code and will have expected result:
That does work actually but even so, I don't think it should be right for the hintText
property of the decorator to have a different alignment compared to the hint
property of the widget
Hi @pongloongyeat, thanks for confirming.
With hintText
property of the decoration, I also don't find a workaround for this currently. So, I will label this issue for further investigation/insight from the team.
This issue is reproducible on the latest stable
and master
channels with provided sample code.
This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
happens in flutter v3.13.6 as well
My workaround here is to display a DropdownMenuItem
that shows the HintText
if the items
are empty.
items: items.isEmpty ? [ DropdownMenuItem( child: Text( widget.hintText!, ), ), ] : Your list of dropdowns
Same issue for me. It seems that hintText disappear if error and I don't find how to however keep hintText. @ecv-arloubeloria : for me, items it never empty even if nothing selected options or error. Hence it's not resolve issue for me.
For resolve this, we need to change the look of the widget when error throw (not just the validator property).
still having this issue on latest flutter 3.22
@huycozy, is it really necessary to wrap the Text
inside Align
? Mine works well even without that!
I believe this PR disables the hintStyle parameter. For example, if I set a custom color for the hint text using hintStyles, the color wouldn't apply.
Any workarounds?
@Cuiboy Can you file a new issue with a minimal example to reproduce the problem you observed? :pray:
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.
Steps to Reproduce
flutter run
on the code sampleExpected results: hintText should be vertically centered
Actual results: hintText is not vertically centered
Code sample
```dart // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( appBar: AppBar( title: Text("Dropdown test"), ), body: Center( child: DropdownButtonFormFieldRemarks
This seems to only be true for when items == null/empty