persian_datetime_picker 2.7.0 copy "persian_datetime_picker: ^2.7.0" to clipboard
persian_datetime_picker: ^2.7.0 copied to clipboard

A persian (farsi,shamsi) datetime picker for flutter, inspired by material datetime picker.

📆 A persian (farsi,shamsi) datetime picker for flutter, inspired by material datetime picker. #

pub package APK

Persian DateTime Picker Banner

Persian datetime picker inspired by material datetime picker and based on shamsi_date.

The Banner designed by Nader Mozaffari.

Usage #

Add it to your pubspec.yaml file:


dependencies:

persian_datetime_picker: version

In your library add the following import:


import  'package:persian_datetime_picker/persian_datetime_picker.dart';

Here is many examples how to use:

/////////////////////////Example 1////////////////////////////
Jalali picked = await showPersianDatePicker(
    context: context,
    initialDate: Jalali.now(),
    firstDate: Jalali(1385, 8),
    lastDate: Jalali(1450, 9),
);
var label = picked.formatFullDate();
/////////////////////////Example 2////////////////////////////
var picked = await showTimePicker(
  context: context,
  initialTime: TimeOfDay.now(),
);
var label = picked.persianFormat(context);
/////////////////////////Example 3////////////////////////////
  Jalali pickedDate = await showModalBottomSheet<Jalali>(
    context: context,
    builder: (context) {
      Jalali tempPickedDate;
      return Container(
        height: 250,
        child: Column(
          children: <Widget>[
            Container(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  CupertinoButton(
                    child: Text(
                      'لغو',
                      style: TextStyle(
                        fontFamily: 'Dana',
                      ),
                    ),
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                  ),
                  CupertinoButton(
                    child: Text(
                      'تایید',
                      style: TextStyle(
                        fontFamily: 'Dana',
                      ),
                    ),
                    onPressed: () {
                      Navigator.of(context).pop(tempPickedDate ?? Jalali.now());
                    },
                  ),
                ],
              ),
            ),
            Divider(
              height: 0,
              thickness: 1,
            ),
            Expanded(
              child: Container(
                child: CupertinoTheme(
                  data: CupertinoThemeData(
                    textTheme: CupertinoTextThemeData(
                      dateTimePickerTextStyle: TextStyle(fontFamily: "Dana"),
                    ),
                  ),
                  child: PCupertinoDatePicker(
                    mode: PCupertinoDatePickerMode.dateAndTime,
                    onDateTimeChanged: (Jalali dateTime) {
                      tempPickedDate = dateTime;
                    },
                  ),
                ),
              ),
            ),
          ],
        ),
      );
    },
  );
  
 /////////////////////////Example 4//////////////////////////// 
var picked = await showPersianDateRangePicker(
    context: context,
    initialEntryMode: PDatePickerEntryMode.input,
    initialDateRange: JalaliRange(
      start: Jalali(1400, 1, 2),
      end: Jalali(1400, 1, 10),
    ),
    firstDate: Jalali(1385, 8),
    lastDate: Jalali(1450, 9),
  );
  

##Pull request and feedback are always appreciated. ###Contact me with mem.amir.m@gmail.com.

263
likes
140
pub points
94%
popularity

Publisher

unverified uploader

A persian (farsi,shamsi) datetime picker for flutter, inspired by material datetime picker.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on persian_datetime_picker