easy_tech_calendar 0.0.1 easy_tech_calendar: ^0.0.1 copied to clipboard
Easy Calendar
The EasyCalendar package is a customizable calendar widget for Flutter that supports both range and multi-select modes. It allows users to interact with a calendar, select individual days, and toggle date ranges. Features include customizable day colors, week day labels, year and month navigation, and the ability to handle disabled or past dates. The package provides a flexible design for date selection with support for multiple themes and styling options, making it suitable for a variety of use cases, such as booking systems, event planners, or task schedulers.
Getting started #
Usage #
import 'package:calendar/calendar/easy_calendar.dart'; import 'package:calendar/calendar/easy_calendar_controller.dart'; import 'package:flutter/material.dart';
class HomePage extends StatefulWidget { const HomePage({super.key});
@override State
}
class _HomePageState extends State
@override void initState() { controller = EasyCalendarController(); super.initState(); }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Custom Calendar', style: TextStyle(color: Colors.white),), backgroundColor: Colors.green, ), body: Column( children: [ Expanded( child: EasyCalendar( rangeMode: isRangeMode, locale: 'en', controller: controller, ), ), buildButtons() ], ), ); }
Widget buildButtons() { return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // Clear Expanded( child: ElevatedButton( onPressed: () { setState(() { controller.clearSelections(); }); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.grey[300], ), child: const Text( 'Clear', style: TextStyle(color: Colors.black), ), ), ), const SizedBox(width: 12,), // OK Expanded( child: ElevatedButton( onPressed: () { String confirmationMessage; if (isRangeMode) { confirmationMessage = 'Min Date: ${controller.selectedMinDate?.toIso8601String() ?? "None"}\n' 'Max Date: ${controller.selectedMaxDate?.toIso8601String() ?? "None"}'; } else { confirmationMessage = 'Selected Days:\n${controller.selectedDays.map((e) => e.toIso8601String()).join('\n')}'; }
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Confirmation'),
content: Text(confirmationMessage),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close'),
),
],
);
},
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
),
child: const Text(
'OK',
style: TextStyle(color: Colors.white),
),
),
),
],
),
);
}
}