flutter_customized_clean_calendar 1.2.0
flutter_customized_clean_calendar: ^1.2.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_customized_clean_calendar/flutter_customized_clean_calendar.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatelessWidget(),
),
);
}
}
class MyStatelessWidget extends StatefulWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
State<MyStatelessWidget> createState() => _MyStatelessWidgetState();
}
class _MyStatelessWidgetState extends State<MyStatelessWidget> {
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"),
),
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"),
),
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
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
child: const Text('Show Calendar'),
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: Calendar(
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),
),
),
],
),
);
},
);
},
),
);
}
}