persian_modal_date_picker 0.0.3 icon indicating copy to clipboard operation
persian_modal_date_picker: ^0.0.3 copied to clipboard

Persian modal date picker. You can use this package to select Jalali date using `BottomModalSheet`

Persian Modal Date Picker #

Persian_Modal_Date_Picker is a modal date picker which is used to select Jalali date.

  • Jalali Date
  • Set initial date
  • Forward/backward selector
  • Use custom validator for date
image

Usage #

await showPersianDatePicker(
      context,
      (context, Date date) async {
        setState(() {
          _selectedDate = date;
        });
        Navigator.of(context).pop();
      },
      forwardYear: true,
      border: BorderRadius.only(
          topRight: Radius.circular(15), topLeft: Radius.circular(15)),
      validate: (ctx, date) {
        return date.year < 1402;
      },
      submitButtonStyle: defaultButtonsStyle.copyWith(
        text: 'انتخاب',
        backgroundColor: Colors.blueAccent,
        radius: 10,
      ),
    );

Parameters #

showPersianDatePicker(context, onSubmit, {/* ohter optional parameter*/});

ParametersTypeIs RequiredDescription
contextBuildContextYes
onSubmitFutureYesCallback function when a date is selected
initYearintNoInitial the Date Picker with optional date. Note that, this works when initMonth and initDay are provided.
initMonthintNoAs the same as initYear
initDayintNoAs the same as initYear
borderBorderRadiusGeometryNoOptional BorderRadius
yearDirectionYearDirectionNoselect year direction. Values are YearDirection.backward, YearDirection.forward and YearDirection.both
backgroundColorColorNo
marginEdgeInsetsNoDate Picker margin
submitButtonStyleButtonsStyleNoStyle of submit bottom
cancelButtonStyleButtonsStyleNoStyle of cancel bottom
validatebool Function(BuildContext context, Jalali date)NoYou can provide a validate function to check if the selected date is correct or not

The ButtonsStyle class

ParametersTypeIs RequiredDescription
backgroundColorColorNoDefault value is Colors.white
textColorColorNoDefault value is Colors.black
radiusdoubleNoDefault value is 5.0
visibleboolNoDefault value is true
textStringYesDefault value is ''

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

4
likes
120
pub points
66%
popularity

Publisher

verified publisher iconrunwidget.com

Persian modal date picker. You can use this package to select Jalali date using `BottomModalSheet`

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

division, flutter, shamsi_date

More

Packages that depend on persian_modal_date_picker