diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1fd278..7588c40 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,59 +1,38 @@
-## 0.0.1
+##2.0.1
-* Initial version
+* Adding the ability to specify the entry mode for the material date picker.
-## 0.0.2
+##2.0.0
-* Fixing README.md
-* Updating package description
-* Formatting with DartFM
+* Migrating to null-safety
-## 0.1.0
-* Updating documentation!
+##1.0.5
-## 0.1.1
+* Removing unused variables
+* Improving description
-* Formatting with DartFM!
-## 0.1.2
+##1.0.4
-* Fixing an incorrect boolean (iOS picker was inverted with the Android one)
+* Fixing critical issue
-## 0.2.0
+##1.0.3
-* DateFormField now extends FormField. All issues related to this are now fiex
-* The style of the DateField (and by extension the one of DateFormField) is now rigorously applying the theme or any customization.
+* Improving package description
-## 0.2.1
+##1.0.2
-* Adding support for Flutter web
+* Improving package description
-## 0.2.2
+##1.0.1
-* Auto-formatting with dart-fm to meet pub.dev requirements
+* Removing the ripple effect
-## 0.3.0
+##1.0.0
-Breaking changes:
-* No more const constructor.
-
-Deprecated:
-* DateField and DateFormField are now deprecated and will be removed in the next version, please consider switching to
-DateTimeField and DateTimeFormField.
-
-Improvements:
-* Adding support for time. Now you can ask the user for a time, a date or both.
-* Improving performances by setting default value in the constructor.
-* Adding .time constructor for the DateField widget only.
-
-##0.3.1
-
-* Adding the possibility to style the text with TextStyle
-
-##0.3.2
-
-* Formating with dartfm
+* Full support for input decoration
+* New standardized usage, many deprecations
##0.3.3
@@ -62,32 +41,59 @@ Improvements:
Breaking change:
* Removing the label property, please consider using the InputDecoration to customize the label.
-##1.0.0
+##0.3.2
-* Full support for input decoration
-* New standardized usage, many deprecations
+* Formating with dartfm
-##1.0.1
+##0.3.1
-* Removing the ripple effect
+* Adding the possibility to style the text with TextStyle
-##1.0.2
+## 0.3.0
-* Improving package description
+Breaking changes:
+* No more const constructor.
-##1.0.3
+Deprecated:
+* DateField and DateFormField are now deprecated and will be removed in the next version, please consider switching to
+ DateTimeField and DateTimeFormField.
-* Improving package description
+Improvements:
+* Adding support for time. Now you can ask the user for a time, a date or both.
+* Improving performances by setting default value in the constructor.
+* Adding .time constructor for the DateField widget only.
-##1.0.4
+## 0.2.2
-* Fixing critical issue
+* Auto-formatting with dart-fm to meet pub.dev requirements
-##1.0.5
+## 0.2.1
-* Removing unused variables
-* Improving description
+* Adding support for Flutter web
-##2.0.0
+## 0.2.0
-* Migrating to null-safety
\ No newline at end of file
+* DateFormField now extends FormField. All issues related to this are now fiex
+* The style of the DateField (and by extension the one of DateFormField) is now rigorously applying the theme or any customization.
+
+## 0.1.2
+
+* Fixing an incorrect boolean (iOS picker was inverted with the Android one)
+
+## 0.1.1
+
+* Formatting with DartFM!
+
+## 0.1.0
+
+* Updating documentation!
+
+## 0.0.2
+
+* Fixing README.md
+* Updating package description
+* Formatting with DartFM
+
+## 0.0.1
+
+* Initial version
diff --git a/README.md b/README.md
index 26c56e3..e092b7d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
Contains DateTimeField and DateTimeFormField which allows the user to pick a DateTime from an input field! Depending on
the mode, it can ask the user the time, the date or both at the same time ;) !
-
+
## Usage
@@ -15,7 +15,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
```yaml
dependencies:
...
- date_field: ^1.0.4
+ date_field: ^2.0.1
```
In your library add the following import:
@@ -40,7 +40,7 @@ You can also specify whether you would like to ask the user for a date, a time o
## Example
-The following picture illustrates some of the things you can do with this package.
+The following picture illustrates some things you can do with this package.
diff --git a/lib/date_field.dart b/lib/date_field.dart
index b6ccc05..7b832f0 100644
--- a/lib/date_field.dart
+++ b/lib/date_field.dart
@@ -30,6 +30,7 @@ class DateTimeFormField extends FormField {
DateTime? lastDate,
ValueChanged? onDateSelected,
InputDecoration? decoration,
+ DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
DatePickerMode initialDatePickerMode = DatePickerMode.day,
DateTimeFieldPickerMode mode = DateTimeFieldPickerMode.dateAndTime,
}) : super(
@@ -65,6 +66,7 @@ class DateTimeFormField extends FormField {
selectedDate: field.value,
enabled: enabled,
mode: mode,
+ initialEntryMode: initialEntryMode,
dateTextStyle: dateTextStyle,
);
},
@@ -89,6 +91,7 @@ class DateTimeField extends StatelessWidget {
this.decoration,
this.enabled = true,
this.mode = DateTimeFieldPickerMode.dateAndTime,
+ this.initialEntryMode = DatePickerEntryMode.calendar,
this.dateTextStyle,
DateTime? firstDate,
DateTime? lastDate,
@@ -105,6 +108,7 @@ class DateTimeField extends StatelessWidget {
this.decoration,
this.enabled,
this.dateTextStyle,
+ this.initialEntryMode = DatePickerEntryMode.calendar,
DateTime? firstDate,
DateTime? lastDate,
}) : initialDatePickerMode = null,
@@ -144,6 +148,9 @@ class DateTimeField extends StatelessWidget {
/// [TextStyle] of the selected date inside the field.
final TextStyle? dateTextStyle;
+ /// The initial entry mode for the material date picker dialog
+ final DatePickerEntryMode initialEntryMode;
+
/// Shows a dialog asking the user to pick a date !
Future _selectDate(BuildContext context) async {
final DateTime initialDateTime = selectedDate ?? DateTime.now();
@@ -173,6 +180,7 @@ class DateTimeField extends StatelessWidget {
context: context,
initialDatePickerMode: initialDatePickerMode!,
initialDate: initialDateTime,
+ initialEntryMode: initialEntryMode,
firstDate: firstDate,
lastDate: lastDate,
);
@@ -193,11 +201,12 @@ class DateTimeField extends StatelessWidget {
if (_selectedTime != null) {
_selectedDateTime = DateTime(
- _selectedDateTime.year,
- _selectedDateTime.month,
- _selectedDateTime.day,
- _selectedTime.hour,
- _selectedTime.minute);
+ _selectedDateTime.year,
+ _selectedDateTime.month,
+ _selectedDateTime.day,
+ _selectedTime.hour,
+ _selectedTime.minute,
+ );
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index ba80505..3dec2f4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: date_field
description: A widget in the form of a field that lets people choose a date, a time or both.
-version: 2.0.0
+version: 2.0.1
homepage: 'https://github.com/GaspardMerten/date_field'
environment: