Skip to content

Commit

Permalink
Set initial value in text field in date field. (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalpeshp0310 authored Apr 26, 2024
1 parent 54f66f7 commit af49386
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/components/datepicker/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class _TUIDatePickerState extends State<TUIDatePicker> {
super.initState();
_dateController = widget.controller ?? material.TextEditingController();
_dateFormat = widget.format ?? _getDefaultDateTimeFormat();
if (widget.initialDate != null || widget.initialTime != null) {
if (widget.initialDate != null) {
_selectedDate = combine(widget.initialDate!, widget.initialTime);
} else {
_selectedDate = convert(widget.initialTime);
}
_dateController.text = _dateFormat.format(_selectedDate!);
}
}

@override
Expand Down

0 comments on commit af49386

Please sign in to comment.