flutter_customized_clean_calendar 1.0.0
flutter_customized_clean_calendar: ^1.0.0 copied to clipboard
Simple and clean flutter calendar with ability to slide up/down to show weekly/monthly calendar with background on every date.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_clean_calendar/flutter_clean_calendar.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Flutter Clean Calendar Demo',
home: CalendarScreen(),
);
}
}
class CalendarScreen extends StatefulWidget {
const CalendarScreen({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _CalendarScreenState();
}
}
class _CalendarScreenState extends State<CalendarScreen> {
final Map<DateTime, List<CleanCalendarEvent>> _events = {
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1):
[
CleanCalendarEvent(
title: "Product Title",
date: "2020-06-01 12:05 AM",
formerPrice: "5000 Birr",
discountPrice: "3000 Birr",
quantity: "1 items",
status: "Pending",
image: Image.network("https://picsum.photos/200"),
),
],
};
@override
void initState() {
super.initState();
// Force selection of today on first load, so that the list of today's events gets shown.
_handleNewDate(DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Calendar(
bgImage: const AssetImage("assets/images/calendar_selected.png"),
startOnMonday: true,
weekDays: const ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
events: _events,
isExpandable: true,
eventDoneColor: Colors.green,
selectedColor: Colors.pink,
todayColor: Colors.blue,
eventColor: Colors.black,
locale: 'en',
todayButtonText: 'Today',
isExpanded: true,
expandableDateFormat: 'EEEE, dd. MMMM yyyy',
dayOfWeekStyle: const TextStyle(
color: Colors.black, fontWeight: FontWeight.w800, fontSize: 11),
),
),
);
}
void _handleNewDate(date) {
print('Date selected: $date');
}
}