我正在尝试为看起来像 的代码实现用户输入
目前,我只有一个容器,其中包含一行,其中包含 4 个容器,每个容器包含一个 TextFormField。我如何实现上述目标
Padding(
padding: const EdgeInsets.all(8.0),
child: new Form(
child: Container(
color: Colors.blue[100],
height: 100.0,
width: 350.0,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
color: Colors.amber,
height: 50.0,
width: 50.0,
child: TextFormField(),
),
Container(
color: Colors.amber,
height: 50.0,
width: 50.0,
child: TextFormField(),
),
Container(
color: Colors.amber,
height: 50.0,
width: 50.0,
child: TextFormField(),
),
Container(
color: Colors.amber,
height: 50.0,
width: 50.0,
child: TextFormField(),
),
),
],
最佳答案
我创建了 this 小例子,我认为这将帮助您实现相同的想法。并回顾一下:
TextField
FoucusNode
更改为另一个Theme
小部件并从那里更改主题 LengthLimitingTextInputFormatter
decoration: InputDecoration(
contentPadding: const EdgeInsets.all(8.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
),
hintText: "0",
),
关于flutter - 在 Flutter 中创建带有圆角且没有激活指示器的 TextFormField,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51907745/