|
|
|
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,
|
|
|
|
daysOfWeekHeight: 22,
|
|
|
|
headerStyle: HeaderStyle(
|
|
|
|
titleCentered: false,
|
|
|
|
headerMargin: EdgeInsets.only(
|
|
|
|
left: 12,
|
|
|
|
),
|
|
|
|
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(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|