在扑来中设置小时时输入时的时间验证错误
大家好,我遇到了一些麻烦 form builderdateTimePicker
我的问题是我的问题是手动设置值(使用键盘不使用窗口小部件提供的图形拖动“箭头”),我每次 hour 值值在12到00之间都会验证错误。
例如,如果我设置12个:30该值将被接受,但是如果我将小时更改为16:30,它将显示验证错误消息。在下面,您可以找到我案件的图形表示。
这是我设置formBuilderTimePicker
窗口小部件的方式,
FormBuilderDateTimePicker(
name: 'fieldname',
initialValue: DateTime.now(),
initialDate: DateTime.now(),
initialEntryMode: DatePickerEntryMode.input,
alwaysUse24HourFormat: true,
onChanged: (value) => mayValue = ,
format: DateFormat.yMMMMd('it_IT').add_Hm(),
timePickerInitialEntryMode: TimePickerEntryMode.input,
)
Hi everyone I have some troubles with Flutter FormBuilderDateTimePicker
My problem is that when I set the value manually (with a keyboard not using graphical draggable 'arrows' offered by the widget) I get the validation error every time the hour value is between 12 and 00.
For example, if I set 12:30 the value will be accepted, but if I change the hour to 16:30 it will display a validation error message. Below you can find a graphical representation of my case.
Here is how I set my FormBuilderTimePicker
widget
FormBuilderDateTimePicker(
name: 'fieldname',
initialValue: DateTime.now(),
initialDate: DateTime.now(),
initialEntryMode: DatePickerEntryMode.input,
alwaysUse24HourFormat: true,
onChanged: (value) => mayValue = ,
format: DateFormat.yMMMMd('it_IT').add_Hm(),
timePickerInitialEntryMode: TimePickerEntryMode.input,
)
The other input type is working fine, but I would like to keep them both
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flutter_form_builder: ^7.3.1
源代码,lovelyuse24hourformat
尚未使用。正如为了使它起作用,他们覆盖
transitionBuilder
,以便在showtimepicker
上下文上提供24小时格式。您可以检查在扑朔迷离时如何使用24小时时钟使用24小时时钟?他们已经讨论了更多。
On
flutter_form_builder: ^7.3.1
source code,alwaysUse24HourFormat
has not being used. As matias-de-andrea mention on git issue which is still open.To make it work, they override the
transitionBuilder
in order to provide 24h format onshowTimePicker
context.You can check How to use 24 hour clock when invoking showTimePicker() in Flutter? and they've discussed more about this.
您可以使用新的
主题
和设置errorStyle
inputDecorationThemeTheme
to 0来禁用小时/分钟的TextField高度降低降低计时器选择器的构建器。You can disable hour/minute textfield height decreasing by wrapping the builder of timer picker with a new
Theme
and settingerrorStyle
ofinputDecorationTheme
to 0.