如何在Flutter中的TextField标签中添加红色星号

fhity93d  于 2023-05-18  发布在  Flutter
关注(0)|答案(2)|浏览(233)

如何在Flutter

中的TextFormField标签中添加红色星号

hxzsmxv2

hxzsmxv21#

Using this code you can achieve that kind of styling in flutter.
     TextField(
            decoration: InputDecoration(
              hintText: 'Ciao',
              suffixText: '*',
              suffixStyle: TextStyle(
                color: Colors.red,
              ),
            ),
          ),
f0ofjuux

f0ofjuux2#

尝试为标签文本使用RichText

decoration: InputDecoration(
    label: Text.rich(TextSpan(children: [
      TextSpan(text: 'ThisIsLabelText'),
      TextSpan(text: ' *', style: TextStyle(color: Colors.red)),
    ]))
  ),

相关问题