Ein Formularfeld-Widget zum Auswählen von DateTime-Werten mithilfe adaptiver Material- und Cupertino-Datums- und Uhrzeit-Auswahlsteuerelemente. Es bietet auch globale Funktionen, um die Auswahlsteuerelemente bereitzustellen.
Aus öffentlichen Paketdaten erstellte Orientierung.
date_field ist ein Flutter-Paket, das ein Formularfeld-Widget zur Auswahl von DateTime-Werten mit an die Plattform angepassten Pickern bereitstellt – Material Design für Android und Web sowie Cupertino für iOS. Es unterstützt alle wichtigen Plattformen, einschließlich macOS, Windows und Linux. Das Paket enthält globale Funktionen, um Datum- und Zeitpicker überall im App-Code einfach aufzurufen und die Integration in Formulare und Benutzerworkflows zu vereinfachen. Es sorgt für eine konsistente Benutzererfahrung über Plattformen hinweg, während der native Eindruck beibehalten wird.
Entwickler, die plattformübergreifende Apps mit Datums-Eingaben erstellen
Apps, die native Datumsauswahler benötigen
Formularitätsstarke Anwendungen mit zeitbezogenen Daten
Teams, die Plattform-spezifische UI-Konsistenz priorisieren
Hinweise
Benötigt Flutter SDK 2.5 oder höher
Für nicht-englische Sprachen kann zusätzliche Lokalisierungseinstellungen erforderlich sein
Eingeschränkte Anpassung der Picker-Ansicht über grundlegende Optionen hinaus
Abhängig von plattformspezifischen Renderverhalten
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Welcome to the Date Field package! 📅
This package provides two widgets, DateTimeField and DateTimeFormField, which allow users to pick a
date and/or time from an input field. You can customize the appearance of the widgets using the
decoration argument, and specify whether to ask for a date, a time, or both using the mode
parameter. You can further customize the picker by configuring dialog properties.
iOS
Android
Getting Started 🚀
Add date_field package to your dependencies in pubspec.yaml.
dependencies:...date_field:^6.0.0
Run flutter pub get to install the package.
Initialize your systems locale. If not, users might see AM/PM even when
they configured their system to use 24h format. Add the following code to your main function:
To display the adaptive dialog without the field widget, you can directly use the showAdaptiveDateTimePicker.
finalDateTime? result = awaitshowAdaptiveDateTimePicker(
context: context,
mode: DateTimeFieldPickerMode.dateAndTime,
);
Note that you can also use the showMaterialDateTimePicker and showCupertinoDateTimePicker functions to show
the Material and Cupertino pickers directly.
Features 🎨
DateTimeField: A widget that allows users to pick a date and/or time from an input field.
DateTimeFormField: A FormField that contains a DateTimeField.
showAdaptiveDateTimePicker: A function that shows a date and/or time picker dialog based on the platform,
with the ability to customize the dialog properties.
showCupertinoDateTimePicker: A function that shows a Cupertino date and/or time picker dialog.
showMaterialDateTimePicker: A function that shows a Material date picker dialog.
Migration to 4.0.0 🚀
Version 4.0.0 contains breaking changes. Use dart fix to migrate to the latest version.
Known Issues 🐛
The pickers and formatted DateTimes adjust only on iOS and Android to the Device Systems Region.
On all other platforms, the pickers adjust to the locale.
See 32006
License 📜
This package is released under the MIT license.
Contributing 🤝
Contributions to this package are welcome! If you find a bug or have a feature request, please
create an issue on the GitHub repository. If you'd like to contribute code, please create a pull
request with your changes.
Before submitting a pull request, please make sure to run the tests and ensure they all pass.
Additionally, please follow the existing coding style and make sure your code is well-documented.