我是颤振的新手,我正在尝试通过单击使用 FormBuilderChoiceChip 创建的芯片之一来更改颤振 FormBuilderDateTimePicker 的初始值。我需要将FormBuilderChoiceChip下的每个FormBuilderFieldOption的值添加到FormBuilderDateTimePicker的initialValue中。这是代码:
child: Column(
children: <Widget>[
FormBuilderChoiceChip(
attribute: "custom_days",
spacing: 3.0,
options: [
FormBuilderFieldOption(
child: Text("3 Days"),
value: 3
),
FormBuilderFieldOption(
child: Text("5 Days"),
value: 5
),
FormBuilderFieldOption(
child: Text("7 Days"),
value: 7
),
],
),
FormBuilderDateTimePicker(
attribute: "date",
inputType: InputType.date,
format: DateFormat("dd-MM-yyyy"),
decoration: InputDecoration(labelText: "Select Date"),
initialValue: DateTime.now(),
)
]
)