सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
फ्लटर के लिए पूरी तरह से कस्टमाइज़ करने योग्य फारसी (फारसी) डेट पिकर, जिसका उद्देश्य दाहिने से बाएं भाषाओं का समर्थन करना है और सुगम डेट चयन प्रदान करना है। इसमें डेटटाइम संचालन के लिए निर्मित विधियाँ शामिल हैं, जिससे फ्लटर एप्लिकेशन में जलाली (फारसी) कैलेंडर तारीखों के साथ काम करना आसान हो जाता है। यह पैकेज ईरानी या फारसी भाषी उपयोगकर्ताओं के लिए उपयुक्त है, जो स्थानीयकृत प्रारूप और स्टाइलिंग विकल्प के साथ निरंतर अनुभव प्रदान करता है। इसे सरल pub add कमांड के माध्यम से मौजूदा फ्लटर प्रोजेक्ट्स में आसानी से एकीकृत किया जा सकता है।
उपयोग
फ़ारसी भाषी दर्शकों के लिए ऐप्स को स्थानीयकृत करना
फॉर्म में जालाली कैलेंडर तारीखों का प्रबंधन
अपॉइंटमेंट स्लॉट व्यवस्थापन प्रणाली का निर्माण
ईरानी ई-कॉमर्स ऐप में तारीख़ चयनकर्ता को एकीकृत करना
मध्य पूर्व बाजार के लिए सांस्कृतिक उपयुक्त UI बनाना
मुख्य विशेषताएँ
जालाली (फ़ारसी) कैलेंडर का समर्थन करता है
पूरी तरह से कस्टमाइज़ किया गया UI
निर्मित तारीख़ और समय संचालन उपकरण
बाएं से दाएं भाषा सुसंगतता
Flutter के साथ आसान एकीकरण
कस्टमाइज़ किए गए थीम और स्टाइल
इनके लिए उपयुक्त
ईरान या फ़ारसी भाषी उपयोगकर्ताओं के लिए ऐप
जालाली तिथि प्रबंधन की आवश्यकता वाले विकासकर्ता
RTL इंटरफेस समर्थन की आवश्यकता वाले प्रोजेक्ट
तारीख़ इनपुट वाले फॉर्म-भारी एप्लिकेशन
लचीले तारीख चयनकर्ता घटक चाहने वाले UI डिज़ाइनर
विचार योग्य बातें
गैर-डिफ़ॉल्ट थीम के लिए हस्तक्षेप सेटअप आवश्यक है
सीमित प्लेटफॉर्म-विशिष्ट अनुकूलन
किन्हीं किनारे के मामलों के लिए अतिरिक्त स्थानीयीकरण की आवश्यकता हो सकती है
जालाली रूपांतरण के लिए बाह्य पुस्तकालय पर निर्भर है
गैर-फ़ारसी स्थानों के लिए अनअनुकूलित
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Persian DatePicker & DateTime Manipulation
A persian ( farsi ) datepicker for flutter.
to see an example of date conversion and manipulation, refer to DateTime section in this page.
Usage
A simple example with a TextField which turns into a datepicker
/*Inline DatePicker*/
persianDatePicker = PersianDatePicker(
controller: textEditingController,
datetime: '1397/06/19',
).init();
....
returnColumn(
children: <Widget>[
// Simple Date PickerContainer(
child: persianDatePicker, // just pass `persianDatePicker` variable as child with no ( )
),
// you can omit TextField when using datepicker as inlineTextField(
enableInteractiveSelection: false,
controller: textEditingController,
),
],
);
Customized DatePicker
You can customize datepicker as you wish, there are a lot of options to set, below code is just a few of them.
/*Customized Font Family ( Farsi Digits )*/
persianDatePicker = PersianDatePicker(
controller: textEditingController,
farsiDigits: true
).init();
Or if you have a font which supports farsi digits then you can simply pass the font name and everything would be ok
اگر فونتی در برنامه استفاده کرده اید که قابلیت نمایش اعداد فارسی را دارد تنها لازم است اسم فونت را به دیت پیکر بدهید
/*Customized Font Family ( Farsi Digits )*/
persianDatePicker = PersianDatePicker(
controller: textEditingController,
fontFamily: 'Vazir'// here I used Vazir font
).init();
Events
onChange: fires after tapping on a day. It has two arguments, oldText and newText which represents the value of datepicker before-tap and after-tap respectively.
You can now use following methods with PersianDateTime instances implemented methods:
toJalaali( format ) // see output formats
toGregorian( format ) // see output formats
isAfter
isBefore
difference
isEqual
add
subtract
All above methods work on persian ( farsi ) dates. if you want to work with gregorian datetime use Dart DateTime class
PersianDateTime persianDate1 = PersianDateTime(jalaaliDateTime: '1397/06/09'); // default is now/*
persianDate1 contains following properties
jalaaliYear 1397
jalaaliMonth 6
jalaaliDay 9
jalaaliShortYear 97
jalaaliZeroLeadingMonth 06
jalaaliZeroLeadingDay 09
jalaaliMonthName شهریور
gregorianYear 2018
gregorianMonth 8
gregorianDay 31
gregorianShortYear 18
gregorianZeroLeadingDay 31
gregorianZeroLeadingMonth 08
gregorianMonthName October
gregorianShortMonthName Oct
datetime Dart DateTime class of current persian date
*/print(persianDate1.toGregorian()); // 2018-08-31print(persianDate1.datetime); // 2018-08-31 00:00:00.000PersianDateTime persianDate2 = persianDate1.add(Duration(days: 10));
print(persianDate2.isBefore(persianDate1)); // falseprint(persianDate2.isAfter(persianDate1)); // trueprint(persianDate2.difference(persianDate1).inDays); // 10print(persianDate2.difference(persianDate1).inHours); // 240PersianDateTime persianDate3 = PersianDateTime(); // default is nowprint(persianDate3.isEqual(persianDate1)); // false// you can accept date as gregorian using `.fromGregorian` constructor. it will automatically convert into jalaali datePersianDateTime persianDate3 = PersianDateTime.fromGregorian(); // default is nowprint(persianDate3.toJalaali(format: 'YYYY/MM/DD')); // 1397/11/19
Output formats
YYYY full year YY 2 digits year MMMM full month name ( doesn't work in datepicker ) MMM short month name ( this only works in gregorian dates and also doesn't work in datepicker ) MM leading zero month digit M month without leading zero DD leading zero day digit D day without leading zero
Important Notes نکات مهم
up to this version all output dates are in persian.
تا این نسخه تمام تاریخ های خروجی پارسی(جلالی) هستند
rangeSeparator and your custom date separator should not be equal, otherwise datepicker will return null
مقدار ورودی rangeSeparator و جداکننده ای که برای فرمت خروجی انتخاب کرده اید نباید یکی باشند در این صورت دیت پیکر خروجی جداکننده های محدوده و خروجی مشابه هستند برمیگرداند
Persian input dates must respect YYYY/MM/DD format. output format is up to you
Gregorian input dates must respect YYYY-MM-DD format. output format is persian and up to you
فرمت تاریخ های ورودی که پارسی (جلالی) هستند باید بصورت
YYYY/MM/DD
باشد. فرمت خروجی به دلخواه شماست
فرمت تاریخ های ورودی که میلادی هستند باید بصورت
YYYY-MM-DD
باشد. فرمت تاریخ خروجی، پارسی و به دلخواه شما خواهد بود
Version 1.3 features
/// حداکثر تاریخی که میتوان در دیت پیکر انتخاب کرد
String maxDatetime;
/// حداقل تاریخی که میتوان در دیت پیکر انتخاب کرد
String minDatetime;
/// حداکثر فاصله ای که تاریخ شروع و تاریخ پایان میتوانند نسبت به یکدیگر داشته باشند
Duration maxSpan;
/// حداقل فاصله ای که تاریخ شروع و تاریخ پایان میتوانند نسبت به یکدیگر داشته باشند
Duration minSpan;
in order to update these options programmatically you can use update method, like so
...
FlatButton(
onPressed: () {
minSpan = Duration(days: 10);
setState(() {
// here you can update the options
persianDatePicker.update(
minSpan: minSpan,
minDatetime: '1397/12/19',
maxDatetime: '1397/12/29');
});
},
child: Container(
child: Text('Update Datepicker'),
),
)
...
Examples
You can find the full example in the Git Repository, example directory