cupertino_hebrew_date_picker 0.0.2 copy "cupertino_hebrew_date_picker: ^0.0.2" to clipboard
cupertino_hebrew_date_picker: ^0.0.2 copied to clipboard

A new Flutter package for showing a Cupertino-styled Hebrew calendar/date picker.

example/lib/main.dart

import 'package:cupertino_hebrew_date_picker/cupertino_hebrew_date_picker.dart';
import 'package:flutter/material.dart';
import 'package:kosher_dart/kosher_dart.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Hebrew Date Picker',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var selectedDate = DateTime.now();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Text(
                'sleected date: - ${HebrewDateFormatter().format(JewishDate.fromDateTime(selectedDate))}'),
            TextButton(
              onPressed: () {
                showHebrewCupertinoDatePicker(
                    confirmText: "Confirm",
                    initialDate: DateTime.now(),
                    context: context,
                    // Everytime the date is changed, the callback is called
                    onDateChanged: (dateTime) {
                      setState(() {
                        selectedDate = dateTime;
                      });
                    },
                    // When the users clicks on the confirm button, the onConfirm callback is called.
                    onConfirm: (dateTime) {
                      print(dateTime);
                    });
              },
              child: const Text("Open picker"),
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
150
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter package for showing a Cupertino-styled Hebrew calendar/date picker.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, kosher_dart

More

Packages that depend on cupertino_hebrew_date_picker