calendar_picker_ghe 2.2.0
calendar_picker_ghe: ^2.2.0 copied to clipboard
A lightweight Gregorian, Hijri, and Ethiopian Calendar date picker which is simple to use with a unified system.
calendar_picker_ghe #
A lightweight, customizable Flutter date picker supporting:
- ποΈ Gregorian Calendar
- π Hijri Calendar
- π Ethiopian Calendar
Easily switch between calendars using a unified API with a clean, customizable dialog interface.
β¨ Features #
- π Easy month/year navigation via dropdowns and arrows
- β Highlights for todayβs date and selected date
- π Configurable year range:
firstYear
,lastYear
, andinitialYear
- π Multilingual support: English (default), Amharic, Arabic
- π― Unified function:
showUnifiedDatePicker(...)
- π Clean, extensible codebase for integrating other calendars
- π± Responsive for small and large screens
πΈ Screenshots #
π¬π§ English #
Gregorian | Ethiopian | Hijri |
---|---|---|
πͺπΉ Amharic #
Gregorian | Ethiopian | Hijri |
---|---|---|
πΈπ¦ Arabic #
Gregorian | Ethiopian | Hijri |
---|---|---|
π Getting Started #
π¦ Installation #
Run this command in your Flutter terminal:
flutter pub add calendar_picker_ghe
This will add the following line to your pubspec.yaml and fetch the package:
dependencies:
calendar_picker_ghe: ^2.2.0
π₯ Import the Package #
import 'package:calendar_picker_ghe/calendar_picker.dart';
π§ͺ Usage #
final pickedDate = await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.ethiopian, // or .hijri / .gregorian
initialYear: 2015,
firstYear: 2000,
lastYear: 2030,
);
π§ Full Function Signature #
Future<dynamic> showUnifiedDatePicker({
required BuildContext context,
required CalendarType calendarType,
required int initialYear,
required int firstYear,
required int lastYear,
String locale = 'en', // Optional: 'en', 'am', or 'ar'
});
π Field Descriptions #
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
context |
BuildContext |
β Yes | β | The build context from which the date picker will be shown. |
calendarType |
CalendarType |
β Yes | β | The calendar system to use: gregorian , ethiopian , or hijri . |
initialYear |
int |
β Yes | β | The year that will be initially displayed when the picker opens. |
firstYear |
int |
β Yes | β | The earliest year a user can navigate to and select. |
lastYear |
int |
β Yes | β | The latest year a user can navigate to and select. |
locale |
String |
β No | 'en' |
Language: 'en' (English), 'am' (Amharic), or 'ar' (Arabic) |
π Locale Options #
By default, the date picker uses English. Use the locale parameter to switch language:
Locale | Language |
---|---|
'en' |
English (default) |
'am' |
Amharic |
'ar' |
Arabic |
β Usage Examples (All 9 Possibilities) #
// Gregorian - English (default)
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.gregorian,
initialYear: DateTime.now().year,
firstYear: 1900,
lastYear: 2100,
);
// Gregorian - Amharic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.gregorian,
initialYear: DateTime.now().year,
firstYear: 1900,
lastYear: 2100,
locale: 'am',
);
// Gregorian - Arabic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.gregorian,
initialYear: DateTime.now().year,
firstYear: 1900,
lastYear: 2100,
locale: 'ar',
);
// Ethiopian - English
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.ethiopian,
initialYear: Ethiopian.now().year,
firstYear: 1900,
lastYear: 2100,
);
// Ethiopian - Amharic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.ethiopian,
initialYear: Ethiopian.now().year,
firstYear: 1900,
lastYear: 2100,
locale: 'am',
);
// Ethiopian - Arabic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.ethiopian,
initialYear: Ethiopian.now().year,
firstYear: 1900,
lastYear: 2100,
locale: 'ar',
);
// Hijri - English
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.hijri,
initialYear: Hijri.now().year,
firstYear: 1358,
lastYear: 1500,
);
// Hijri - Amharic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.hijri,
initialYear: Hijri.now().year,
firstYear: 1358,
lastYear: 1500,
locale: 'am',
);
// Hijri - Arabic
await showUnifiedDatePicker(
context: context,
calendarType: CalendarType.hijri,
initialYear: Hijri.now().year,
firstYear: 1358,
lastYear: 1500,
locale: 'ar',
);
π Notes #
To set the initial year dynamically:
initialYear: DateTime.now().year, // Gregorian
initialYear: Hijri.now().year, // Hijri (requires Hijri converter)
initialYear: Ethiopian.now().year, // Ethiopian (requires Ethiopian converter)
π License #
This project is licensed under the terms of the Apache License 2.0.
π¬ Contact #
For questions, feedback, or contributions:
π§ Email: halidawell00@gmail.com