jalali_flutter_datepicker 1.0.4
jalali_flutter_datepicker: ^1.0.4 copied to clipboard
custom date picker A persian (farsi,shamsi) datetime picker for flutter, inspired by material datetime picker and persian date time picker.
Jalali Flutter Date Picker
Jalali Flutter Date Picker is a customizable Jalali (Persian) date picker widget for Flutter. This package allows you to easily integrate a Jalali date picker into your Flutter applications with various customization options, including colors for different date states.
Features
- Selectable Date Range: Define a range of selectable dates using `firstDateRange` and `lastDateRange` properties.
- Customizable Colors: Set different colors for enabled, disabled, selected, and today's dates using various properties.
- Year Selection:** Navigate between years using the built-in dropdown menus.
- Dynamic Month & Year:** Months and years are generated dynamically based on the selectable date range.
- Fully Customizable:** Adjust the look and feel of the date picker to match your app's design.
Installation
To use Jalali Flutter Date Picker in your project, add it to your `pubspec.yaml` file:
dependencies:
jalali_flutter_datepicker: ^latest_version
Then, run `flutter pub get` to install the package.
Usage
Import the package in your Flutter code:
import 'package:jalali_flutter_datepicker/jalali_flutter_datepicker.dart';
Example
This example demonstrates how to use the `JalaliFlutterDatePicker` widget in your application:
JalaliFlutterDatePicker(
onDateChanged: (value) {
// Handle the date change in your application
},
initialDate: Jalali(1350, 3, 2), // The initial date displayed
firstDateRange: Jalali(1340, 3, 1), // Earliest selectable date
lastDateRange: Jalali(1360, 8, 29), // Latest selectable date
disabledDayColor: Colors.grey,
enabledDayColor: Colors.black,
selectedDayBackground: const Color(0xffFD9404),
selectedDayColor: Colors.white,
todayColor: const Color(0xffFD9404),
footerIconColor: const Color(0xffFD9404),
footerTextStyle: const TextStyle(color: Color(0xffFD9404), fontSize: 12),
headerTextStyle: const TextStyle(color: Color(0xffFD9404)),
customArrowWidget: const Icon(Icons.arrow_upward_sharp),
)
Explanation of Fields
onDateChanged: A callback function triggered when the user selects a date.initialDate: The initial date displayed when the date picker opens.firstDateRange: The earliest selectable date.lastDateRange: The latest selectable date.- (Color Properties): Customize the colors for different date states.
footerIconColor,footerTextStyle,headerTextStyle: Style the footer and header text.