modern_date_picker 0.1.0 copy "modern_date_picker: ^0.1.0" to clipboard
modern_date_picker: ^0.1.0 copied to clipboard

A beautiful, customizable date picker widget for Flutter with modern calendar UI, month/year navigation, and dark/light theme support.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'screens/basic_example.dart';
import 'screens/themed_example.dart';
import 'screens/date_range_example.dart';
import 'screens/localized_example.dart';
import 'screens/time_picker_example.dart';
import 'screens/showcase_example.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Date Widget Examples',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      darkTheme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.dark,
        ),
        useMaterial3: true,
      ),
      home: const ExampleHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Date Widget Examples'),
        centerTitle: true,
      ),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          _ExampleTile(
            title: 'Showcase',
            subtitle: 'All widget variants at a glance',
            icon: Icons.grid_view,
            onTap: () => _navigateTo(context, const ShowcaseExample()),
          ),
          _ExampleTile(
            title: 'Basic Usage',
            subtitle: 'Simple date picker with default settings',
            icon: Icons.calendar_today,
            onTap: () => _navigateTo(context, const BasicExample()),
          ),
          _ExampleTile(
            title: 'Custom Themes',
            subtitle: 'Light, dark, and custom color themes',
            icon: Icons.palette,
            onTap: () => _navigateTo(context, const ThemedExample()),
          ),
          _ExampleTile(
            title: 'Date Range Constraints',
            subtitle: 'Limit selectable dates with min/max bounds',
            icon: Icons.date_range,
            onTap: () => _navigateTo(context, const DateRangeExample()),
          ),
          _ExampleTile(
            title: 'Date & Time Picker',
            subtitle: 'Combined date and 24-hour time selection',
            icon: Icons.schedule,
            onTap: () => _navigateTo(context, const TimePickerExample()),
          ),
          _ExampleTile(
            title: 'Localization',
            subtitle: 'Custom labels for different languages',
            icon: Icons.language,
            onTap: () => _navigateTo(context, const LocalizedExample()),
          ),
        ],
      ),
    );
  }

  void _navigateTo(BuildContext context, Widget page) {
    Navigator.push(
      context,
      MaterialPageRoute(builder: (context) => page),
    );
  }
}

class _ExampleTile extends StatelessWidget {
  final String title;
  final String subtitle;
  final IconData icon;
  final VoidCallback onTap;

  const _ExampleTile({
    required this.title,
    required this.subtitle,
    required this.icon,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.only(bottom: 12),
      child: ListTile(
        leading: CircleAvatar(
          backgroundColor: Theme.of(context).colorScheme.primaryContainer,
          child: Icon(icon, color: Theme.of(context).colorScheme.primary),
        ),
        title: Text(title),
        subtitle: Text(subtitle),
        trailing: const Icon(Icons.chevron_right),
        onTap: onTap,
      ),
    );
  }
}
1
likes
160
points
91
downloads

Publisher

unverified uploader

Weekly Downloads

A beautiful, customizable date picker widget for Flutter with modern calendar UI, month/year navigation, and dark/light theme support.

Repository (GitHub)
View/report issues

Topics

#widget #date-picker #calendar #ui #time-picker

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on modern_date_picker