This repository has been archived on 2022-04-20. You can view files and clone it, but cannot push or open issues or pull requests.
app/lib/components/datetimePicker.dart
konrad 521ac1bae0
Some checks failed
continuous-integration/drone/push Build is failing
Moved the datetimepicker to custom widget
2019-03-17 12:59:45 +01:00

37 lines
1.1 KiB
Dart

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,
));
}
}