diff --git a/lib/src/field.dart b/lib/src/field.dart index a809da3..681630c 100644 --- a/lib/src/field.dart +++ b/lib/src/field.dart @@ -23,6 +23,7 @@ class DateTimeField extends StatelessWidget { this.initialEntryMode = DatePickerEntryMode.calendar, this.dateTextStyle, this.initialDate, + this.use24hFormat = false, DateTime? firstDate, DateTime? lastDate, DateFormat? dateFormat, @@ -39,6 +40,7 @@ class DateTimeField extends StatelessWidget { this.enabled, this.initialDate, this.dateTextStyle, + this.use24hFormat = false, this.initialEntryMode = DatePickerEntryMode.calendar, DateTime? firstDate, 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 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. final DateTimeFieldPickerMode mode; @@ -112,6 +117,7 @@ class DateTimeField extends StatelessWidget { initialDateTime: initialDateTime, minimumDate: firstDate, maximumDate: lastDate, + use24hFormat: use24hFormat, ), ); }, diff --git a/lib/src/form_field.dart b/lib/src/form_field.dart index 3df9c9f..bae689a 100644 --- a/lib/src/form_field.dart +++ b/lib/src/form_field.dart @@ -20,6 +20,7 @@ class DateTimeFormField extends FormField { DateTime? initialValue, AutovalidateMode? autovalidateMode, bool enabled = true, + bool use24hFormat = false, TextStyle? dateTextStyle, DateFormat? dateFormat, DateTime? firstDate, @@ -63,6 +64,7 @@ class DateTimeFormField extends FormField { onDateSelected: onChangedHandler, selectedDate: field.value, enabled: enabled, + use24hFormat: use24hFormat, mode: mode, initialEntryMode: initialEntryMode, dateTextStyle: dateTextStyle, diff --git a/pubspec.lock b/pubspec.lock index 967afee..e680b3d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" clock: dependency: transitive description: @@ -40,14 +40,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" sky_engine: dependency: transitive description: flutter @@ -66,6 +66,6 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.14.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 80005cb..a5efcdb 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.1.2 +version: 2.1.3 homepage: 'https://github.com/GaspardMerten/date_field' environment: