scrolling_day_calendar 1.0.4 scrolling_day_calendar: ^1.0.4 copied to clipboard
A flutter calendar package to allow users to scroll through given dates
scrolling_day_calendar #
A flutter calendar package for scrolling through given days as date heading and display items for that day. This package can be used on Android and IOS
How it works #
You simply need to pass in a start date, an end date, the active date and a call-back function, the package will then allow the user to swipe between the dates using PageView, on each page change the call-back you have set will be called to allow you to update the page content for the given date.
Screenshots #
Usage #
To use the plugin:
- add the dependency to your pubspec.yaml
dependencies:
flutter:
sdk: flutter
scrolling_day_calendar: 1.0.4
- import the package
import 'package:scrolling_day_calendar/scrolling_day_calendar.dart';
How to use #
// set the initial page value
Widget _pageItems = Text("Inital value");
DateTime selectedDate = DateTime.now();
DateTime startDate = DateTime.now().subtract(Duration(days: 10));
DateTime endDate = DateTime.now().add(Duration(days: 10));
// add to body
ScrollingDayCalendar(
startDate: startDate, // Datetime object
endDate: endDate, // Datetime object
selectedDate: selectedDate, // Datetime object
onDateChange: (direction, DateTime selectedDate) {
setState(() {
print(selectedDate);
_pageItems = Text("No data"); // this will display on the new page
});
},
dateStyle: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
pageItems: _pageItems,
dateFormat: "dd/MM/yyyy", // using the intl date format string
dateBackgroundColor: Colors.grey,
forwardIcon: Icons.arrow_forward,
backwardIcon: Icons.arrow_back,
pageChangeDuration: Duration(
milliseconds: 700,
),
);