DatePickerTextField class
A read-only text field that opens a date-picker on tap.
By default it uses Flutter's built-in showDatePicker. Pass a customPickerBuilder to inject any alternative calendar system — for example a Bikram Sambat (Nepali BS) picker:
DatePickerTextField(
labelText: 'जन्म मिति',
customPickerBuilder: (ctx, current) async {
final bs = await showNepaliDatePicker(context: ctx, ...);
return bs?.toDateTime(); // convert to Gregorian DateTime
},
onChanged: (value) => print(value),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DatePickerTextField
- Available extensions
Constructors
-
DatePickerTextField({Key? key, String? labelText = 'Select Date', String? hintText, DateTime? initialDate, DateTime? firstDate, DateTime? lastDate, String dateFormatter(DateTime date)?, DatePickerBuilder? customPickerBuilder, Widget? suffixIcon, String? validator(String? value)?, VoidCallbackWithValue<
String> ? onChanged, VoidCallbackWithValue<String> ? onSaved}) -
const
Properties
- customPickerBuilder → DatePickerBuilder?
-
Replace the built-in showDatePicker with any custom picker — e.g. a
Nepali BS calendar, a Persian calendar, or a range picker.
final
- dateFormatter → String Function(DateTime date)?
-
Converts the picked DateTime to the string stored in the field.
Defaults to
'yyyy-MM-dd'formatting.final - defaultHorizontalSpace → SizedBox
-
Available on Widget, provided by the WidgetExtension extension
no setter - defaultVerticalSpace → SizedBox
-
Available on Widget, provided by the WidgetExtension extension
no setter - firstDate → DateTime?
-
Earliest selectable date. Defaults to
DateTime(1900).final - hashCode → int
-
The hash code for this object.
no setterinherited
- hintText → String?
-
Placeholder shown when no date is selected.
final
- initialDate → DateTime?
-
The date shown when the picker opens for the first time.
Defaults to
DateTime.now().final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelText → String?
-
Shown above the field. Defaults to
'Select Date'.final - lastDate → DateTime?
-
Latest selectable date. Defaults to ten years from today.
final
-
onChanged
→ VoidCallbackWithValue<
String> ? -
Called every time the selected date changes (formatted string).
final
-
onSaved
→ VoidCallbackWithValue<
String> ? -
Called when the form is saved (formatted string).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- suffixIcon → Widget?
-
Suffix widget rendered inside the text field.
Defaults to a calendar icon.
final
- validator → String? Function(String? value)?
-
Optional form validator.
final
Methods
-
center(
) → Center -
Available on Widget, provided by the WidgetExtension extension
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DatePickerTextField> -
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
-
lightGreyBackground(
{required BuildContext context}) → Container -
Available on Widget, provided by the WidgetExtension extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
GestureTapCallback callback, {VoidCallback? onLongPress}) → InkWell -
Available on Widget, provided by the WidgetExtension extension
-
padAll(
{double? value}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padBottom(
{double? bottom}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padHorizontal(
{double? horizontal}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padLeft(
{double? left}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padRight(
{double? right}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padTop(
{double? top}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padVertical(
{double? vertical}) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
padZero(
) → Padding -
Available on Widget, provided by the WidgetExtension extension
-
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
-
visible(
bool visible, {Widget? defaultWidget}) → Widget -
Available on Widget, provided by the WidgetExtension extension
set visibility
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited