【问题标题】:How to make label text centered in flutter如何使标签文本以颤动为中心
【发布时间】:2020-05-11 18:36:43
【问题描述】:

我们可以让标签文本居中吗?我尝试使用文本对齐,但它只会使提示文本和输入文本居中,而不是标签文本。这是我的代码:

TextFormField(
  style: TextStyle(
    color: Colors.white,
  ),
  // textAlign: TextAlign.center,
  decoration: InputDecoration(

    hintText: 'example@gmail.com',
    hintStyle: TextStyle(                      
      color: Colors.white,
    ),
    alignLabelWithHint: true,
    labelStyle: TextStyle(
    color: Color(0xff9fe0ff),
    fontSize: 25,
  ),
  border: UnderlineInputBorder(
  borderSide: BorderSide(
  color: Color(0xff9fe0ff),
  ),
),
  labelText: 'Email',
),
),

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    默认的TextFormField 无法做到这一点。如您所见,有一个未解决的问题:https://github.com/flutter/flutter/issues/2735

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-23
      • 1970-01-01
      • 2022-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多