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

A date range picker for Flutter

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Date range picker example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Date range picker example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            DateRangePickerWidget(
              initialDisplayedDate: DateTime(2023,11,20),
              onPeriodChanged: (Period value) {
                debugPrint(value.toString());
              },
            )
          ],
        ),
      ),
    );
  }
}