From 8af4a61072ec038dcc42aeb702e7955b47916779 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 25 Apr 2020 10:10:52 +0200 Subject: [PATCH] Fix issue --- lib/ui/widgets/post_create_form_widget.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ui/widgets/post_create_form_widget.dart b/lib/ui/widgets/post_create_form_widget.dart index 9249302..0ab9f6a 100644 --- a/lib/ui/widgets/post_create_form_widget.dart +++ b/lib/ui/widgets/post_create_form_widget.dart @@ -231,14 +231,15 @@ class _PostCreateFormWidgetState extends State { /// Pick countdown time Future _pickCountdownTime() async { - final initialDate = - _timeEnd == null ? DateTime.now().add(Duration(minutes: 1)) : _timeEnd; + final yesterday = DateTime.now().subtract(Duration(days: 1)); + + final initialDate = _timeEnd == null ? DateTime.now() : _timeEnd; // Pick date final newDate = await showDatePicker( context: context, initialDate: initialDate, - firstDate: DateTime.now(), + firstDate: yesterday.isBefore(initialDate) ? yesterday : initialDate, lastDate: DateTime.now().add(Duration(days: 5000))); if (newDate == null) return;