Added the 24Hr Format

Added the 24Hr Format
This commit is contained in:
Tempelritter 2021-12-22 12:57:37 +01:00
parent bf47b6c6c6
commit d10bb24830
4 changed files with 14 additions and 6 deletions

View file

@ -23,6 +23,7 @@ class DateTimeField extends StatelessWidget {
this.initialEntryMode = DatePickerEntryMode.calendar, this.initialEntryMode = DatePickerEntryMode.calendar,
this.dateTextStyle, this.dateTextStyle,
this.initialDate, this.initialDate,
this.use24hFormat = false,
DateTime? firstDate, DateTime? firstDate,
DateTime? lastDate, DateTime? lastDate,
DateFormat? dateFormat, DateFormat? dateFormat,
@ -39,6 +40,7 @@ class DateTimeField extends StatelessWidget {
this.enabled, this.enabled,
this.initialDate, this.initialDate,
this.dateTextStyle, this.dateTextStyle,
this.use24hFormat = false,
this.initialEntryMode = DatePickerEntryMode.calendar, this.initialEntryMode = DatePickerEntryMode.calendar,
DateTime? firstDate, DateTime? firstDate,
DateTime? lastDate, DateTime? lastDate,
@ -76,6 +78,9 @@ class DateTimeField extends StatelessWidget {
/// Whether the field is usable. If false the user won't be able to select any date /// Whether the field is usable. If false the user won't be able to select any date
final bool? enabled; final bool? enabled;
/// Whether to use the 24Hr Format
final bool use24hFormat;
/// Whether to ask the user to pick only the date, the time or both. /// Whether to ask the user to pick only the date, the time or both.
final DateTimeFieldPickerMode mode; final DateTimeFieldPickerMode mode;
@ -112,6 +117,7 @@ class DateTimeField extends StatelessWidget {
initialDateTime: initialDateTime, initialDateTime: initialDateTime,
minimumDate: firstDate, minimumDate: firstDate,
maximumDate: lastDate, maximumDate: lastDate,
use24hFormat: use24hFormat,
), ),
); );
}, },

View file

@ -20,6 +20,7 @@ class DateTimeFormField extends FormField<DateTime> {
DateTime? initialValue, DateTime? initialValue,
AutovalidateMode? autovalidateMode, AutovalidateMode? autovalidateMode,
bool enabled = true, bool enabled = true,
bool use24hFormat = false,
TextStyle? dateTextStyle, TextStyle? dateTextStyle,
DateFormat? dateFormat, DateFormat? dateFormat,
DateTime? firstDate, DateTime? firstDate,
@ -63,6 +64,7 @@ class DateTimeFormField extends FormField<DateTime> {
onDateSelected: onChangedHandler, onDateSelected: onChangedHandler,
selectedDate: field.value, selectedDate: field.value,
enabled: enabled, enabled: enabled,
use24hFormat: use24hFormat,
mode: mode, mode: mode,
initialEntryMode: initialEntryMode, initialEntryMode: initialEntryMode,
dateTextStyle: dateTextStyle, dateTextStyle: dateTextStyle,

View file

@ -7,7 +7,7 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.2.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -40,14 +40,14 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.7.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -66,6 +66,6 @@ packages:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.14.0 <3.0.0"

View file

@ -1,6 +1,6 @@
name: date_field name: date_field
description: A widget in the form of a field that lets people choose a date, a time or both. description: A widget in the form of a field that lets people choose a date, a time or both.
version: 2.1.2 version: 2.1.3
homepage: 'https://github.com/GaspardMerten/date_field' homepage: 'https://github.com/GaspardMerten/date_field'
environment: environment: