Calendar View

A Flutter package that provides a customizable calendar view widget showing a full month calendar with task cards.

Getting started

Add the package to your pubspec.yaml:

dependencies:
  oxean_calendar_view: ^0.1.0

Usage

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Create some tasks
    final tasks = [
      CalendarTask(
        id: '1',
        title: 'Important meeting',
        date: DateTime(2025, 4, 15),
        color: Colors.red,
      ),
      CalendarTask(
        id: '2',
        title: 'Submit report',
        date: DateTime(2025, 4, 18),
        color: Colors.blue,
      ),
      CalendarTask(
        id: '3',
        title: 'Review code',
        date: DateTime(2025, 4, 18),
        color: Colors.green,
        isCompleted: true,
      ),
    ];

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Calendar Example')),
        body: Center(
          child: MonthlyCalendar(
            tasks: tasks,
            onDaySelected: (date) {
              print('Selected date: $date');
            },
            onTaskSelected: (task) {
              print('Selected task: ${task.title}');
            },
            todayColor: Colors.blue,
            selectedColor: Colors.orange,
          ),
        ),
      ),
    );
  }
}

Customization

You can customize the calendar using these properties:

MonthlyCalendar(
  // Optional initial date (defaults to today)
  initialDate: DateTime(2025, 4, 14),

  //Optional start year and end year for the year picker
  startYear: 2020,
  endYear: 2030,

  // Tasks to display on the calendar
  tasks: tasks,

  // Called when a day is selected
  onDaySelected: (date) {
    // Do something with the selected date
  },

  // Called when a task is tapped
  onTaskSelected: (task) {
    // Do something with the selected task
  },

  // Visual customization
  todayColor: Colors.red,
  selectedColor: Colors.green,
  textColor: Colors.black,
  backgroundColor: Colors.white,
)

Additional information

For more examples and detailed documentation, check the example folder.

To run the example app:

cd example
flutter run

License

This project is licensed under the MIT License - see the LICENSE file for details.