flutter calendaro
calendaro, a calendar widget library for flutter apps. offers multiple ways to customize the widget.
getting started
installation
add dependency to your pubspec.yaml:
calendarro: ^1.0.0
basic use
first, add an import to your code:
import 'package:calendarro/calendarro.dart';
add a widget to your code:
calendarro(
startdate: dateutils.getfirstdayofcurrentmonth(),
enddate: dateutils.getlastdayofcurrentmonth()
)
customization
1. display mode – if you prefer to operate on multiple rows to see whole month, use:
calendarro(
displaymode: displaymode.months,
...
)
2. selection mode – if you want to select multiple dates, use:
calendarro(
selectionmode: selectionmode.multi,
...
)
3. weekday labels – if you want to provide your own row widget for displaying weekday names, use:
calendarro(
weekdaylabelsrow: customweekdaylabelsrow()
...
)
you can create your customweekdaylabelsrow by looking at default calendarroweekdaylabelsview.
4. day tile builder – if you want to build day tiles your own way, you can use:
calendarro(
daytilebuilder: customdaytilebuilder()
...
)
you can create your customdaytilebuilder looking upon defaultdaytilebuilder.
5. initial selected dates – when you want some dates to be selected from the scratch, use selecteddate (selectionmode.single) or selecteddates (selectionmode.multi) arguments:
calendarro(
selecteddate: datetime(2018, 8, 1)
//or
selecteddates: [datetime(2018, 8, 1), datetime(2018, 8, 8)]
...
)
you can create your customdaytilebuilder looking upon defaultdaytilebuilder.
selecting date callback
if you want to get a callback when a date tile is clicked, there is ontap param:
calendarro(
ontap: (date) {
//your code
}
...
)
Comments are closed.