Skip to content

baset68/ir_datetime_picker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iranian Date & Time picker

Iranian (Persian - Farsi - Shamsi - Jalali) DateTime picker with cupertino style and responsive UI.

Version Platform

Demo:

Demo

Usage

Step1: add dependency to your pubspec.yaml:

dependencies:
  ir_datetime_picker: version

Step2: import library:

import 'package:ir_datetime_picker/ir_datetime_picker.dart';

Step3: check exmaple to use:

/// Pick date with IRDatePickerResponsiveDialog:
ElevatedButton(
  child: const Text("pick date with dialog"),
  onPressed: () async {
    Jalali? selectedDate = await showIRDatePickerDialog(context, enableTodayButton: true);
    if (selectedDate != null) {
      setState(() {
        _date = "${selectedDate.year}/${selectedDate.month}/${selectedDate.day}";
      });
    }
  },
)


/// Pick date with IRDatePickerResponsiveRoute:
ElevatedButton(
  child: const Text("pick date with route"),
  onPressed: () async {
    Jalali? selectedDate = await showIRDatePickerRoute(context, enableTodayButton: true);
    if (selectedDate != null) {
      setState(() {
        _date = "${selectedDate.year}/${selectedDate.month}/${selectedDate.day}";
      });
    }
  },
)


/// You can create your own date picker with IRDatePicker widget:
const Text("use as custom:", style: TextStyle(fontSize: 18.0)),
Directionality(
  textDirection: TextDirection.rtl,
  child: IRDatePicker(
    startYear: 1380,
    endYear: 1420,
    initialDate: Jalali(1400, 6, 12),
    enableTodayButton: true,
    todayButtonText: "برو به امروز",
    onSelected: (Jalali selectedDate) {
      setState(() {
        _date = "${selectedDate.year}/${selectedDate.month}/${selectedDate.day}";
      });
    },
  ),
)


/// Pick time with IRTimePickerResponsiveDialog:
ElevatedButton(
  child: const Text("Pick Time"),
  onPressed: () async {
    IRTimeModel? time = await showIRTimePickerDialog(context);
    if (time != null) {
      setState(() {
        _time = time.toString();
      });
    }
  },
)

Support

If you have any issues or questions, please don't hesitate to reach out to us at Alikhajavi74@gmail.com

https://github.com/alikhajavi74

About

Iranian datetime picker package for FlutterDevelopers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 98.4%
  • Swift 1.1%
  • Other 0.5%