This commit is contained in:
konrad 2019-03-17 16:30:39 +01:00
parent 2437270031
commit d572c2a5e3
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 18 additions and 17 deletions

View File

@ -24,19 +24,19 @@ class VikunjaDateTimePicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DateTimePickerFormField(
dateOnly: false,
editable:
false, // Otherwise editing the date is not possible, this setting affects the underlying text field.
initialValue: initialValue == DateTime.fromMillisecondsSinceEpoch(0)
? null
: initialValue,
format: vDateFormatLong,
decoration: InputDecoration(
labelText: label,
border: border,
icon: icon,
),
onSaved: onSaved,
);
dateOnly: false,
editable:
false, // Otherwise editing the date is not possible, this setting affects the underlying text field.
initialValue: initialValue == DateTime.fromMillisecondsSinceEpoch(0)
? null
: initialValue,
format: vDateFormatLong,
decoration: InputDecoration(
labelText: label,
border: border,
icon: icon,
),
onSaved: onSaved,
);
}
}

View File

@ -36,7 +36,8 @@ class _TaskEditPageState extends State<TaskEditPage> {
@override
Widget build(BuildContext ctx) {
_repeatAfterType = getRepeatAfterTypeFromDuration(widget.task.repeatAfter);
_repeatAfterValue = getRepeatAfterValueFromDuration(widget.task.repeatAfter);
_repeatAfterValue =
getRepeatAfterValueFromDuration(widget.task.repeatAfter);
return Scaffold(
appBar: AppBar(

View File

@ -2,7 +2,7 @@ getRepeatAfterTypeFromDuration(Duration repeatAfter) {
if (repeatAfter == null || repeatAfter.inSeconds == 0) {
return null;
}
// if its dividable by 24, its something with days, otherwise hours
if (repeatAfter.inHours % 24 == 0) {
if (repeatAfter.inDays % 7 == 0) {
@ -63,4 +63,4 @@ getDurationFromType(String value, String type) {
case 'Years':
return Duration(days: val * 365);
}
}
}