mirror of
https://github.com/go-vikunja/app
synced 2024-06-02 18:49:47 +00:00
ee99869cf6
* Ran make format Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Add VS Code launch config Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * pages/list/list.dart: Stop spinning wheel after adding a task Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * stores/list_store.dart: Fix updateTask() not being a future Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Replace FlatButton with TextButton widgets Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * components/TaskTile.dart: Remove dead code Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * theme/theme.dart: Fix accentColor deprecation Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * pages/list/list_edit.dart: Fix SnackBar.hideCurrentSnackBar() deprecation Signed-off-by: Timo Reichl <timo.reichl@mailbox.org> * Remove unused folder lib/managers Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>
54 lines
1.6 KiB
Dart
54 lines
1.6 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 Function onChanged;
|
|
final DateTime initialValue;
|
|
final EdgeInsetsGeometry padding;
|
|
final Icon icon;
|
|
final InputBorder border;
|
|
|
|
const VikunjaDateTimePicker({
|
|
Key key,
|
|
@required this.label,
|
|
this.onSaved,
|
|
this.onChanged,
|
|
this.initialValue,
|
|
this.padding = const EdgeInsets.symmetric(vertical: 10.0),
|
|
this.icon = const Icon(Icons.date_range),
|
|
this.border = InputBorder.none,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DateTimeField(
|
|
//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,
|
|
onChanged: onChanged,
|
|
onShowPicker: (context, currentValue) {
|
|
return showDatePicker(
|
|
context: context,
|
|
firstDate: DateTime(1900),
|
|
initialDate: currentValue.millisecondsSinceEpoch > 0
|
|
? currentValue
|
|
: DateTime.now(),
|
|
lastDate: DateTime(2100));
|
|
},
|
|
);
|
|
}
|
|
}
|