Added repeat after
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
c3d699d7f1
commit
76149c315e
|
@ -24,10 +24,10 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
bool _loading = false;
|
||||
final dateFormat = DateFormat("EEEE, MMMM d, yyyy 'at' h:mma");
|
||||
|
||||
int _parentTaskID, _priority;
|
||||
int _parentTaskID, _priority, _repeatAfterValue;
|
||||
DateTime _dueDate, _startDate, _endDate;
|
||||
List<DateTime> _reminderDates;
|
||||
String _text, _description;
|
||||
String _text, _description, _repeatAfterType;
|
||||
Duration _repeatAfter;
|
||||
List<Task> _subtasks;
|
||||
List<Label> _labels;
|
||||
|
@ -84,7 +84,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
),
|
||||
),
|
||||
VikunjaDateTimePicker(
|
||||
icon: Icon(Icons.calendar_today),
|
||||
icon: Icon(Icons.access_time),
|
||||
label: 'Due Date',
|
||||
initialValue: widget.task.dueDate,
|
||||
onSaved: (duedate) => _dueDate = duedate,
|
||||
|
@ -99,6 +99,45 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
initialValue: widget.task.endDate,
|
||||
onSaved: (endDate) => _endDate = endDate,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.number,
|
||||
initialValue: _repeatAfterValue == null ? null : _repeatAfterValue.toString(),
|
||||
onSaved: (repeatAfter) => _repeatAfter = _makeDurationFromType(int.parse(repeatAfter), _repeatAfterType),
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Repeat after',
|
||||
border: InputBorder.none,
|
||||
icon: Icon(Icons.repeat),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// width: 100,
|
||||
child: DropdownButton<String>(
|
||||
value: _repeatAfterType,
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
_repeatAfterType = newValue;
|
||||
});
|
||||
},
|
||||
items: <String>[
|
||||
'Hours',
|
||||
'Days',
|
||||
'Weeks',
|
||||
'Months',
|
||||
'Years'
|
||||
].map<DropdownMenuItem<String>>(
|
||||
(String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
))
|
||||
])),
|
||||
Builder(
|
||||
builder: (context) => Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
|
@ -157,4 +196,19 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
);
|
||||
});
|
||||
}
|
||||
|
||||
_makeDurationFromType(int value, String type) {
|
||||
switch (type) {
|
||||
case 'Hours':
|
||||
return Duration(seconds: value * 60);
|
||||
case 'Days':
|
||||
return Duration(seconds: value * 60 * 24);
|
||||
case 'Weeks':
|
||||
return Duration(seconds: value * 60 * 24 * 7);
|
||||
case 'Months':
|
||||
return Duration(seconds: value * 60 * 24 * 7 * 30);
|
||||
case 'Years':
|
||||
return Duration(seconds: value * 60 * 24 * 7 * 365);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue