flutter_linear_datepicker 2.0.0
flutter_linear_datepicker: ^2.0.0 copied to clipboard

A flutter package providing Gregorian and Jalaali (Persian) date picker

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_linear_datepicker/flutter_datepicker.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'DatePicker Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("DatePicker Demo"),
      ),
      body: Center(
        child: Container(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              LinearDatePicker(
                startDate: "1396/12/12",
                endDate: "1398/01/14",
                initialDate: "1397/05/05",
                dateChangeListener: (String selectedDate) {
                  print(selectedDate);
                },
                showDay: true,
                fontFamily: 'iran',
                textColor: Colors.black,
                selectedColor: Colors.deepOrange,
                unselectedColor: Colors.blueGrey,
                yearText: "سال | year",
                monthText: "ماه | month",
                dayText: "روز | day",
                showLabels: true,
                columnWidth: 100,
                showMonthName: true,
                isJalaali: true,
              ),
              RaisedButton(
                child: Text(
                  "Pick Date | انتخاب تاریخ",
                ),
                onPressed: () {
                  showDateDialog(context);
                },
              ),
            ],
          ),
        ),
      ),
    );
  }

  void showDateDialog(BuildContext context) {
    showDialog(
        context: context,
        builder: (_) => AlertDialog(
              title: Text('Choose Date'),
              content: LinearDatePicker(
                dateChangeListener: (String selectedDate) {
                  print(selectedDate);
                },
                showMonthName: true,
                isJalaali: true,
              ),
            ));
  }
}
6
likes
120
pub points
77%
popularity

A flutter package providing Gregorian and Jalaali (Persian) date picker

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

alikhaleghi76@gmail.com

License

LICENSE

Dependencies

flutter, shamsi_date

More

Packages that depend on flutter_linear_datepicker