material_hebrew_date_picker 1.0.0+6 copy "material_hebrew_date_picker: ^1.0.0+6" to clipboard
material_hebrew_date_picker: ^1.0.0+6 copied to clipboard

A material hebrew date picker.

Material Hebrew Date Picker #

A customizable Material Design Hebrew date picker for Flutter applications, supporting both single date and date range selection. This package provides a culturally appropriate date selection experience for apps targeting Hebrew/English-speaking users.

Features #

  • Hebrew calendar support with accurate date calculations
  • Single date and date range selection modes
  • Customizable themes
  • Support for both Hebrew and Gregorian date display
  • Responsive design for various screen sizes
  • Right-to-left (RTL) support for Hebrew text
  • Today highlighting
  • Year selection mode
  • Customizable color scheme and typography

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  material_hebrew_date_picker: 1.0.0+6

Then run:

$ flutter pub get

Usage #

Import the package in your Dart code:

import 'package:material_hebrew_date_picker/material_hebrew_date_picker.dart';

Single Date Picker #

image
void _showSingleDatePicker() async {
  await showMaterialHebrewDatePicker(
    context: context,
    initialDate: DateTime.now(),
    firstDate: DateTime(2000),
    lastDate: DateTime(2100),
    hebrewFormat: true,
    onDateChange: (date) {
      print('Date changed: $date');
    },
    onConfirmDate: (date) {
      print('Date confirmed: $date');
      // Handle the confirmed date
    },
  );
}

Date Range Picker #

image
void _showDateRangePicker() async {
  final DateTimeRange? result = await showMaterialHebrewDateRangePicker(
    context: context,
    firstDate: DateTime.now(),
    lastDate: DateTime.now().add(Duration(days: 365)),
    hebrewFormat: true,
  );

  if (result != null) {
    print('Selected range: ${result.start} to ${result.end}');
    // Handle the selected date range
  }
}

Using with kosher_dart #

While not required, you may want to use the kosher_dart package for advanced Hebrew date functionality. Here's an example:

import 'package:kosher_dart/kosher_dart.dart';

void _showSingleDatePicker() {
  showMaterialHebrewDatePicker(
    context: context,
    initialDate: _selectedDate ?? DateTime.now(),
    firstDate: JewishDate().getGregorianCalendar(),
    lastDate: JewishDate().getGregorianCalendar().add(const Duration(days: 30)),
    hebrewFormat: false,
    onDateChange: (date) {
      print('Date changed: $date');
    },
    onConfirmDate: (date) {
      print('Date confirmed: $date');
      setState(() {
        _selectedDate = date;
      });
    },
  );
}

To use kosher_dart, add it to your pubspec.yaml:

dependencies:
  kosher_dart: ^2.0.16  # Use the latest version

Customization #

You can customize the appearance of the date picker using the HebrewDatePickerTheme class:

HebrewDatePickerTheme customTheme = HebrewDatePickerTheme(
  primaryColor: Colors.blue,
  onPrimaryColor: Colors.white,
  surfaceColor: Colors.white,
  onSurfaceColor: Colors.black87,
  disabledColor: Colors.grey,
  selectedColor: Colors.blue,
  todayColor: Colors.orange,
  headerTextStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
  bodyTextStyle: TextStyle(fontSize: 14),
  weekdayTextStyle: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
);

showMaterialHebrewDatePicker(
  // ... other parameters
  theme: customTheme,
);

Localization #

The package supports both Hebrew and English languages. The language is determined by the hebrewFormat parameter:

  • When hebrewFormat is true, the picker displays in Hebrew.
  • When hebrewFormat is false, the picker displays in English.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE.md file for details.

Support #

If you have any questions or run into any problems, please open an issue in the GitHub repository.

3
likes
130
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A material hebrew date picker.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, kosher_dart

More

Packages that depend on material_hebrew_date_picker