flutter_month_range 0.0.5 copy "flutter_month_range: ^0.0.5" to clipboard
flutter_month_range: ^0.0.5 copied to clipboard

A simple and elegant horizontal month range picker widget for Flutter.

example/main.dart

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Month Range Picker',
      home: Scaffold(
        appBar: AppBar(title: const Text('Flutter Month Range Picker')),
        body: const Center(child: PickerDemo()),
      ),
    );
  }
}

class PickerDemo extends StatelessWidget {
  const PickerDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: () async {
        DateTimeRange? result = await showDialog<DateTimeRange>(
          context: context,
          builder: (context) => CustomDateRangePicker(
            firstDate: DateTime(2022, 1, 1),
            lastDate: DateTime(2030, 12, 31),
            startDateLabel: 'Start Date',
            endDateLabel: 'End Date',
            dateFormat: 'dd-MM-yyyy',
            monthYearFormat: 'MMM yyyy',
            disablePastDates: true,
            applyButtonText: 'Done',
            applyButtonHeight: 46,
            applyButtonBackgroundColor: Colors.blue,
            applyButtonTextColor: Colors.white,
            rangeColor: Colors.blue.shade300,
            selectedDateColor: Colors.blue.shade700,
            selectedDateBorderColor: Colors.white,
            customApplyButton: Container(
              padding: EdgeInsets.symmetric(vertical: 16, horizontal: 32),
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  colors: [Colors.teal, Colors.purple],
                ),
                borderRadius: BorderRadius.circular(25),
              ),
              child: Center(
                child: Text(
                  'Book Now',
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ),
          ),
        );

        if (result != null) {
          print('Selected: ${result.start} to ${result.end}');
        }
      },
      child: const Text('Open Month Range Picker'),
    );
  }
}
1
likes
150
points
40
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple and elegant horizontal month range picker widget for Flutter.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, intl

More

Packages that depend on flutter_month_range