Skip to content

caesar-feng/FlutterCalendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_calendar

A Flutter Calendar

web demo url https://www.ixiaojin.com/#/

image image

image image

image

Add this to your package's pubspec.yaml file:

dependencies:
  imba_calendar: ^0.0.3
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Calendar(
        //the controller to control Calendar expand shrink jumpToTargetDate
        calendarController: calendarController,
        //it also be used to GridAxisSpacing
        backgroundColor: Colors.grey,
        //you can close the SliverPersistentHeader by false
        //also you could use a custom SliverPersistentHeader
        //by sliverPersistentHeader,if you use is you must tell Calendar
        //the custom SliverPersistentHeader`s height
        showSliverPersistentHeader: true,
        //if the scroll is not long enough isCalendarExpanded will be invalid
        isCalendarExpanded: true,
        onItemClick: (bean) => onItemClick(bean),
        itemBuilder:
            (BuildContext context, int index, CalendarItemState bean) =>
                Container(
          color: bean.dateTime == CalendarBuilder.selectedDate
              ? Colors.pinkAccent.shade100
              : Colors.white,
          alignment: Alignment.center,
          child: Text(
            "${bean.day}",
            style: TextStyle(color: Colors.black),
          ),
        ),
        //the day will be return -1 when user select day out of current Month
        // or the pager do not has select day
        // if you want a user select date then you should move to onItemClick
        sliverAppBarBuilder:
            (BuildContext context, int year, int month, int day) =>
                buildAppBar(year, month, day),
        //to add any widgets
        slivers: _buildSlivers(),
      ),
    );
  }

About

A Flutter Calendar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages