hebrew_date_picker 0.1.0
hebrew_date_picker: ^0.1.0 copied to clipboard
A Material-style date picker that shows the Hebrew (Jewish) date in every day cell, the Hebrew months in the month title and the full Hebrew date of the selected day.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:hebrew_date_picker/hebrew_date_picker.dart';
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Hebrew Date Picker',
theme: ThemeData(colorSchemeSeed: Colors.indigo),
home: const ExamplePage(),
);
}
}
class ExamplePage extends StatefulWidget {
const ExamplePage({super.key});
@override
State<ExamplePage> createState() => _ExamplePageState();
}
class _ExamplePageState extends State<ExamplePage> {
DateTime _date = DateTime.now();
Future<void> _pickDate() async {
final picked = await showHebrewDatePicker(
context: context,
initialDate: _date,
firstDate: DateTime(2020),
lastDate: DateTime(2035),
);
if (picked != null) setState(() => _date = picked);
}
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
return Scaffold(
appBar: AppBar(title: const Text('Hebrew Date Picker')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(MaterialLocalizations.of(context).formatFullDate(_date),
style: textTheme.titleMedium),
Text(_date.getHebrewDateFormatted(), style: textTheme.titleLarge),
const SizedBox(height: 24),
FilledButton(onPressed: _pickDate, child: const Text('Pick a date')),
],
),
),
);
}
}