You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.4 KiB
89 lines
2.4 KiB
import 'package:flutter/cupertino.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:table_calendar/table_calendar.dart'; |
|
|
|
class CalendarPage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _CalendarPage(); |
|
} |
|
} |
|
|
|
class _CalendarPage extends State<CalendarPage> with TickerProviderStateMixin { |
|
late AnimationController _animationController; |
|
// CalendarController _calendarController; |
|
|
|
@override |
|
void initState() { |
|
super.initState(); |
|
|
|
// _calendarController = CalendarController(); |
|
|
|
_animationController = AnimationController( |
|
vsync: this, |
|
duration: const Duration(milliseconds: 400), |
|
); |
|
|
|
_animationController.forward(); |
|
} |
|
|
|
@override |
|
void dispose() { |
|
_animationController.dispose(); |
|
// _calendarController.dispose(); |
|
super.dispose(); |
|
} |
|
|
|
void _onDaySelected(DateTime selectedDay, DateTime focusedDay) { |
|
print('CALLBACK: _onDaySelected'); |
|
} |
|
|
|
// void _onVisibleDaysChanged(DateTime first, DateTime last, CalendarFormat format) { |
|
// print('CALLBACK: _onVisibleDaysChanged'); |
|
// } |
|
|
|
void _onCalendarCreated(PageController pageController) { |
|
print('CALLBACK: _onCalendarCreated'); |
|
} |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Container( |
|
child: Column( |
|
mainAxisSize: MainAxisSize.max, |
|
children: [ |
|
_buildTableCalendar(), |
|
], |
|
), |
|
); |
|
} |
|
|
|
Widget _buildTableCalendar() { |
|
return TableCalendar( |
|
startingDayOfWeek: StartingDayOfWeek.monday, |
|
availableGestures: AvailableGestures.none, |
|
headerStyle: HeaderStyle( |
|
titleCentered: false, |
|
leftChevronVisible: false, |
|
rightChevronVisible: false, |
|
formatButtonVisible: false, |
|
), |
|
calendarStyle: CalendarStyle( |
|
outsideDaysVisible: false, |
|
selectedDecoration: BoxDecoration().copyWith(color: Color(0xFF32A060)), |
|
selectedTextStyle: TextStyle().copyWith(color: Color(0xFF333333)), |
|
todayTextStyle: TextStyle().copyWith(color: Color(0xFFD5EBDE)), |
|
), |
|
daysOfWeekStyle: DaysOfWeekStyle( |
|
weekendStyle: TextStyle().copyWith(color: Color(0xFF4D4D4D)), |
|
), |
|
onDaySelected: _onDaySelected, |
|
// onVisibleDaysChanged: _onVisibleDaysChanged, |
|
onCalendarCreated: _onCalendarCreated, |
|
focusedDay: DateTime.now(), |
|
firstDay: DateTime.now(), |
|
lastDay: DateTime.now(), |
|
); |
|
} |
|
|
|
}
|
|
|