Widget timeField4(isEditable, TextEditingController jt, String lbl, fn,
{DateTime? initialValue}
) =>
Container(
padding: const EdgeInsets.all(0),
child: DateTimeField(
enabled: isEditable,
controller: jt,
keyboardType: TextInputType.datetime,
textAlign: TextAlign.center,
format: DateFormat("HH:mm"),
decoration: InputDecoration(
labelText: lbl,
border: const OutlineInputBorder(),
contentPadding:
const EdgeInsets.only(top: 0, bottom: 0, left: 5),
isDense: true,
suffixIcon: IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
jt.text = '';
fn('');
})),
onChanged: (DateTime? newValue) {
if (newValue != null) {
fn('');
}
},
onShowPicker: (context, _) async {
final time = await showTimePicker(
initialEntryMode: TimePickerEntryMode.wheel,
context: context,
initialTime:
TimeOfDay.fromDateTime(initialValue ?? DateTime(0,0,0,0)),
);
return DateTimeField.convert(time);
}));