Moved the datetimepicker to custom widget
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
7cc767b337
commit
521ac1bae0
|
@ -0,0 +1,36 @@
|
|||
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:vikunja_app/theme/constants.dart';
|
||||
|
||||
class VikunjaDateTimePicker extends StatelessWidget {
|
||||
final String label;
|
||||
final Function onSaved;
|
||||
final DateTime initialValue;
|
||||
final EdgeInsetsGeometry padding;
|
||||
|
||||
const VikunjaDateTimePicker({
|
||||
Key key,
|
||||
@required this.label,
|
||||
this.onSaved,
|
||||
this.initialValue,
|
||||
this.padding = const EdgeInsets.symmetric(vertical: 10.0),
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: 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: OutlineInputBorder(),
|
||||
),
|
||||
onSaved: onSaved,
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:vikunja_app/components/datetimePicker.dart';
|
||||
|
||||
import 'package:vikunja_app/global.dart';
|
||||
import 'package:vikunja_app/models/label.dart';
|
||||
|
@ -82,18 +83,11 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: DateTimePickerFormField(
|
||||
dateOnly: false,
|
||||
initialDate: widget.task.dueDate,
|
||||
format: vDateFormatLong,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Due Date',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
onSaved: (duedate) => _dueDate = duedate,
|
||||
)),
|
||||
VikunjaDateTimePicker(
|
||||
label: 'Due Date',
|
||||
initialValue: widget.task.dueDate,
|
||||
onSaved: (duedate) => _dueDate = duedate,
|
||||
),
|
||||
Builder(
|
||||
builder: (context) => Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
|
|
Reference in New Issue