Tasks
This commit is contained in:
parent
45a7c97489
commit
3d3a9f8031
|
|
@ -7,11 +7,13 @@ class TimePicker extends StatefulWidget {
|
|||
@required this.labelText,
|
||||
@required this.onSelected,
|
||||
@required this.selectedDate,
|
||||
this.previousDate,
|
||||
this.validator,
|
||||
this.autoValidate = false,
|
||||
}) : super(key: key);
|
||||
|
||||
final String labelText;
|
||||
final DateTime previousDate;
|
||||
final DateTime selectedDate;
|
||||
final Function(DateTime) onSelected;
|
||||
final Function validator;
|
||||
|
|
@ -52,7 +54,13 @@ class _TimePickerState extends State<TimePicker> {
|
|||
context: context, initialTime: TimeOfDay(hour: hour, minute: minute));
|
||||
|
||||
if (selectedTime != null) {
|
||||
final dateTime = convertTimeOfDayToDateTime(selectedTime);
|
||||
var dateTime = convertTimeOfDayToDateTime(selectedTime);
|
||||
|
||||
if (widget.previousDate != null &&
|
||||
dateTime.isBefore(widget.previousDate)) {
|
||||
dateTime = dateTime.add(Duration(days: 1));
|
||||
}
|
||||
|
||||
_textController.text = formatDate(dateTime.toIso8601String(), context,
|
||||
showTime: true, showDate: false);
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
|
|||
|
||||
_date = startDate.toIso8601String();
|
||||
_startDate = startDate;
|
||||
|
||||
if (endDate != null) {
|
||||
_endDate = endDate;
|
||||
_durationController.text = formatDuration(taskTime.duration);
|
||||
|
|
@ -173,9 +174,9 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
|
|||
.toUtc(),
|
||||
endDate: _endDate != null
|
||||
? DateTime(
|
||||
date.year,
|
||||
date.month,
|
||||
date.day,
|
||||
_endDate.year,
|
||||
_endDate.month,
|
||||
_endDate.day,
|
||||
_endDate.hour,
|
||||
_endDate.minute,
|
||||
_endDate.second)
|
||||
|
|
@ -208,6 +209,7 @@ class TimeEditDetailsState extends State<TimeEditDetails> {
|
|||
key: ValueKey(_endDate),
|
||||
labelText: localization.endTime,
|
||||
selectedDate: _endDate,
|
||||
previousDate: _startDate,
|
||||
onSelected: (timeOfDay) {
|
||||
_endDate = timeOfDay;
|
||||
_durationController.text = _endDate != null
|
||||
|
|
|
|||
Loading…
Reference in New Issue