【发布时间】:2020-07-03 06:32:13
【问题描述】:
我有如下所示的制作文本字段的代码
...Column(
children: <Widget>[
textField(text: 'User Name'),
SizedBox(height: 20),
textField(text: 'Password'), ])...
textField 是我创建的一个类,它具有以下代码来创建一个文本字段。我这样做是为了避免代码重复,因为我在应用程序中经常使用文本字段。
...TextField(
textInputAction: TextInputAction.next,
obscureText: text == 'Password' ? true : false,
textCapitalization: TextCapitalization.words,
cursorColor: primaryColor,
textAlign: TextAlign.center,
decoration: InputDecoration(
labelText: text,
labelStyle: TextStyle(color: primaryColor, fontFamily: 'Bellotta'),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(...
因为我使用这个函数来创建文本字段,所以我不能使用 focusNode 来改变焦点。 我该如何解决这个问题??
【问题讨论】:
标签: flutter focus flutter-layout flutter-text