DatePickerBottomSheet class
A customizable widget for selecting dates through a bottom sheet.
Combines a TextFormField
with a calendar date picker for user-friendly
date input. Supports external controllers, validation, and various
customizations for appearance and functionality.
Example usage:
DatePickerBottomSheet(
controller: myController,
validator: (value) => value?.isEmpty == true ? 'Select a date' : null,
onChanged: (value) => print('Date selected: $value'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DatePickerBottomSheet
Constructors
-
DatePickerBottomSheet({Key? key, TextEditingController? controller, FormFieldValidator<
String> ? validator, ValueChanged<String> ? onChanged, InputDecoration? decoration, String? labelText, String? hintText, String dateFormat = 'dd-MM-yyyy', DateTime? firstDate, DateTime? lastDate, Widget? suffixIcon, TextStyle? style, bool selectableFutureOnly = true, String confirmButtonText = 'Aceptar', String cancelButtonText = 'Cancelar', bool selectableDayPredicate(DateTime date)?, String? bottomSheetText = 'Selecciona una fecha'}) -
Creates a
DatePickerBottomSheet
with customizable properties.const
Properties
- bottomSheetText → String?
-
Text displayed at the top of the bottom sheet.
final
- cancelButtonText → String
-
Text for the cancel button in the bottom sheet.
final
- confirmButtonText → String
-
Text for the confirmation button in the bottom sheet.
final
- controller → TextEditingController?
-
Controller for managing the text field content.
final
- dateFormat → String
-
Format for displaying and parsing dates.
final
- decoration → InputDecoration?
-
Decoration for the
TextFormField
.final - firstDate → DateTime?
-
The earliest selectable date.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintText → String?
-
Hint text displayed within the
TextFormField
.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelText → String?
-
Label text displayed within the
TextFormField
.final - lastDate → DateTime?
-
The latest selectable date.
final
-
onChanged
→ ValueChanged<
String> ? -
Callback triggered when the date changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectableDayPredicate → bool Function(DateTime date)?
-
Predicate to determine which days are selectable.
final
- selectableFutureOnly → bool
-
Whether only future dates can be selected.
final
- style → TextStyle?
-
Text style for the
TextFormField
.final - suffixIcon → Widget?
-
Icon displayed at the end of the
TextFormField
.final -
validator
→ FormFieldValidator<
String> ? -
Validator function for the text field.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DatePickerBottomSheet> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited