persian_datetimepickers 1.0.3+2 icon indicating copy to clipboard operation
persian_datetimepickers: ^1.0.3+2 copied to clipboard

A valuable and straightforward package that supports numeric Jalali(Farsi | Persian) and the Gregorian date and time pickers.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:persian_datetimepickers/persian_datetimepickers.dart';

void main() {
  ThemeData themeData = ThemeData();

  runApp(
    MaterialApp(
      home: const PersianDatePickersExample(),
      theme: themeData.copyWith(
        colorScheme: themeData.colorScheme.copyWith(
          secondary: Colors.purple,
        ),
      ),
    ),
  );
}

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

  @override
  _PersianDatePickersExampleState createState() =>
      _PersianDatePickersExampleState();
}

class _PersianDatePickersExampleState extends State<PersianDatePickersExample> {
  TimeOfDay? _pickedTime;
  DateTime? _pickedDate;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Pickers')),
      body: Column(
        children: <Widget>[
          ListTile(
            title: _pickedTime == null
                ? const Text('Pick a time')
                : const Text('Picked time:'),
            trailing:
                _pickedTime == null ? null : Text(_pickedTime!.toFancyString()),
            onTap: () async {
              final TimeOfDay? time = await showPersianTimePicker(
                context: context,
              );

              setState(() {
                _pickedTime = time;
              });
            },
          ),
          const SizedBox(height: 16),
          ListTile(
            title: _pickedDate == null
                ? const Text('Pick a date')
                : const Text('Picked date:'),
            trailing: _pickedDate == null
                ? null
                : Text(
                    _pickedDate!.toFancyString(),
                  ),
            onTap: () async {
              final DateTime? date = await showPersianDatePicker(
                context: context,
              );

              setState(() {
                _pickedDate = date;
              });
            },
          ),
        ],
      ),
    );
  }
}
14
likes
130
pub points
77%
popularity

Publisher

verified publisher icongabrimatic.info

A valuable and straightforward package that supports numeric Jalali(Farsi | Persian) and the Gregorian date and time pickers.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.unknown (LICENSE)

Dependencies

flutter, numberpicker, shamsi_date

More

Packages that depend on persian_datetimepickers