Adding the possibility to specify a default entry mode for the material calendar - v2.0.1

This commit is contained in:
Gaspard Merten 2021-04-03 21:29:40 +02:00
parent fa2bdd1d4e
commit ddcb665d2f
4 changed files with 79 additions and 64 deletions

View file

@ -1,37 +1,53 @@
## 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
##1.0.0
* Full support for input decoration
* New standardized usage, many deprecations
##0.3.3
* Intl => any support
Breaking change:
* Removing the label property, please consider using the InputDecoration to customize the label.
##0.3.2
* Formating with dartfm
##0.3.1
* Adding the possibility to style the text with TextStyle
## 0.3.0
@ -47,47 +63,37 @@ Improvements:
* Improving performances by setting default value in the constructor.
* Adding .time constructor for the DateField widget only.
##0.3.1
## 0.2.2
* Adding the possibility to style the text with TextStyle
* Auto-formatting with dart-fm to meet pub.dev requirements
##0.3.2
## 0.2.1
* Formating with dartfm
* Adding support for Flutter web
##0.3.3
## 0.2.0
* Intl => any support
* 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.
Breaking change:
* Removing the label property, please consider using the InputDecoration to customize the label.
## 0.1.2
##1.0.0
* Fixing an incorrect boolean (iOS picker was inverted with the Android one)
* Full support for input decoration
* New standardized usage, many deprecations
## 0.1.1
##1.0.1
* Formatting with DartFM!
* Removing the ripple effect
## 0.1.0
##1.0.2
* Updating documentation!
* Improving package description
## 0.0.2
##1.0.3
* Fixing README.md
* Updating package description
* Formatting with DartFM
* Improving package description
## 0.0.1
##1.0.4
* Fixing critical issue
##1.0.5
* Removing unused variables
* Improving description
##2.0.0
* Migrating to null-safety
* Initial version

View file

@ -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 ;) !
<img src='https://raw.githubusercontent.com/GaspardMerten/date_field/master/example/example.PNG' height='250px'></img>
<img src='https://raw.githubusercontent.com/GaspardMerten/date_field/master/example/demo.gif' height='250px'></img>
## 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.
<img src='https://raw.githubusercontent.com/GaspardMerten/date_field/master/example/demo.gif' height='250px'></img>

View file

@ -30,6 +30,7 @@ class DateTimeFormField extends FormField<DateTime> {
DateTime? lastDate,
ValueChanged<DateTime>? onDateSelected,
InputDecoration? decoration,
DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
DatePickerMode initialDatePickerMode = DatePickerMode.day,
DateTimeFieldPickerMode mode = DateTimeFieldPickerMode.dateAndTime,
}) : super(
@ -65,6 +66,7 @@ class DateTimeFormField extends FormField<DateTime> {
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<void> _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,
);
@ -197,7 +205,8 @@ class DateTimeField extends StatelessWidget {
_selectedDateTime.month,
_selectedDateTime.day,
_selectedTime.hour,
_selectedTime.minute);
_selectedTime.minute,
);
}
}

View file

@ -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: