我刚学了 Flutter。这里想问一下如何匹配密码和确认密码。在这里,我将给出我的代码。我也使用 TextField。我在这里不使用验证器来验证
TextField(
key: passkey,
style: new TextStyle(color: Colors.white),
controller: password,
decoration: InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(color: Colors.white),
hintStyle: TextStyle(color: Colors.white),
icon: const Padding(
padding: const EdgeInsets.only(top: 15.0),
child: const Icon(
Icons.lock_outline,
color: Colors.white,
)
),
errorText: validate ? 'Password Can\'t Be Empty' : null,
),
obscureText: _obscureText,
),
TextField(
style: new TextStyle(color: Colors.white),
controller: confirmpassword,
decoration: InputDecoration(
labelText: 'Retype Password',
labelStyle: TextStyle(color: Colors.white),
hintStyle: TextStyle(color: Colors.white),
icon: const Padding(
padding: const EdgeInsets.only(top: 15.0),
child: const Icon(
Icons.lock_outline,
color: …Run Code Online (Sandbox Code Playgroud) 如何将滑块的值扔到文本字段中并且文本字段的输入值可以调整滑块中的值?使用以便这些值相等并且彼此同步。在文本字段中输入的输入可以与滑块中的值相同,并且滑块值可以出现在文本字段中。
Container(
width: 130,
child: TextField(
style: new TextStyle(color: Colors.white),
controller: max,
decoration: InputDecoration(
labelText: 'Max',
labelStyle: TextStyle(color: Colors.white),
hintStyle: TextStyle(color: Colors.white),
),
),
),
// new Text(values.start.toInt().toString()),
// new Text(values.end.toInt().toString()),
new Container(
padding: EdgeInsets.only(top: 50.0),
child: new RangeSlider(
min: 1,
max: 100,
divisions: 100,
values: values,
labels: labels,
onChanged: (value) {
modalSetState(() {
print('START: ${value.start}, END: ${value.end}');
setValuesSlider(value);
labels = RangeLabels('${values.start.toInt().toString()}', '${values.end.toInt().toString()}');
}); //create custom setState for this state
},
),
),
]);
Run Code Online (Sandbox Code Playgroud)