【发布时间】:2022-11-01 22:37:24
【问题描述】:
所以我将我的表单域包装在一个可见的小部件中,以在选中单选按钮时隐藏和显示文本表单域,但我工作正常但你有时必须双击它想要使用 ValueListenableBuilder 和 ValueNotifier 来存档它。
Visibility(
visible: _isVisible,
child: Container(
width: 396,
height: 73,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(0.08),
offset: Offset(0, 2),
blurRadius: 6,
),
],
color: Color(0xffFAFAFA),
borderRadius: BorderRadius.circular(17)),
child: Padding(
padding: const EdgeInsets.fromLTRB(15, 25, 0, 0),
child: TextFormField(
enabled: _character == SingingCharacter.unchecked
? true
: false,
onSaved: (Value) => print(hello),
decoration: InputDecoration(
hintStyle: TextStyle(
fontFamily: "Proxima Nova",
fontWeight: FontWeight.w300,
),
border: InputBorder.none,
labelStyle: TextStyle(
color: Color(0xffFAFAFA),
),
),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r"[0-9]+|\s"))
],
controller: kiloMeter,
validator: (value) {
if (value != null && value.isEmpty || value != 1000) {
return 'Please enter your Kilometer';
}
return null;
},
),
),
),
),
【问题讨论】:
-
_isVisible是什么,你能提供完整的小部件和你的值通知器吗
标签: flutter dart flutter-layout