【问题标题】:Flutter DateTimeFormField Hint Text Color Doesn't ChangeFlutter DateTimeFormField 提示文本颜色不变
【发布时间】:2020-09-08 19:21:19
【问题描述】:

我对 Flutter 上的 DateTimeFormField 有一个大问题。我无法更改提示、标签或默认文本样式颜色更改。

我已经尝试过了;

var textStyle = TextStyle(
  color: Hexcolor("#D8D8D8"),
  fontSize: ScreenUtil().setSp(42.0),
);

return DateTimeFormField(
  mode: widget.mode,
  label: widget.label,
  decoration: InputDecoration(
    filled: true,
    fillColor: Hexcolor("#F9F9F9"),
    contentPadding: EdgeInsets.only(
      left: 20.0,
      top: 20.0,
      bottom: 5.0,
    ),
    prefixStyle: textStyle,
    hintStyle: textStyle,
    labelStyle: textStyle,
    border: defaultBorder,
    focusedBorder: focusedBorder,
    enabledBorder: enabledBorder,
  ),
  onDateSelected: widget.onDateSelected,
  //controller: widget.controller,
  //maxLines: maxLines,
  //obscureText: obscureText,
);

但是颜色看起来像这个图像:

如何更改字段默认颜色?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    从未使用过 Hexcolor 插件,为什么不尝试使用基本颜色,例如:

    Colors.lightBlue

    然后也许还有其他使用 Hexa 的方法:

    颜色(0xFF8BC34A)

    【讨论】:

    • Hexcolor 插件在其他文本字段上也能正常工作,我尝试了你的答案但不起作用:/
    猜你喜欢
    • 2021-12-04
    • 1970-01-01
    • 2019-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 2018-02-27
    • 2019-05-09
    相关资源
    最近更新 更多