답변 2
1
안녕하세요!
이상하네 플러그인 버전이 동일한지 확인 해주세요.
관계없이 아래 코드로 (calendarBuilder 파라미터) 자유롭게 커스터마이징 가능합니다.
class Calendar extends StatelessWidget {
final DateTime focusedDay;
final OnDaySelected onDaySelected;
final bool Function(DateTime day) selectedDayPredicate;
const Calendar({
required this.focusedDay,
required this.onDaySelected,
required this.selectedDayPredicate,
super.key,
});
@override
Widget build(BuildContext context) {
final defaultBoxDecoration = BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
border: Border.all(
color: Colors.grey[200]!,
width: 1.0,
),
);
final defaultTextStyle = TextStyle(
color: Colors.grey[600],
fontWeight: FontWeight.w700,
);
return TableCalendar(
locale: 'ko_KR',
focusedDay: focusedDay,
firstDay: DateTime(1800),
lastDay: DateTime(3000),
headerStyle: HeaderStyle(
formatButtonVisible: false,
titleCentered: true,
titleTextStyle: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w700,
),
),
calendarBuilders: CalendarBuilders(
defaultBuilder: (context, day, focusedDay) {
return Container(
margin: EdgeInsets.all(4.0),
alignment: Alignment.center,
decoration: defaultBoxDecoration,
child: Text(
day.day.toString(),
style: defaultTextStyle,
),
);
},
),
calendarStyle: CalendarStyle(
isTodayHighlighted: true,
defaultDecoration: defaultBoxDecoration,
weekendDecoration: defaultBoxDecoration,
selectedDecoration: defaultBoxDecoration.copyWith(
border: Border.all(
color: primaryColor,
width: 1.0,
),
),
todayDecoration: defaultBoxDecoration.copyWith(
color: primaryColor,
),
outsideDecoration: defaultBoxDecoration.copyWith(
border: Border.all(
color: Colors.transparent,
),
),
defaultTextStyle: defaultTextStyle,
weekendTextStyle: defaultTextStyle,
selectedTextStyle: defaultTextStyle.copyWith(
color: primaryColor,
),
),
onDaySelected: onDaySelected,
selectedDayPredicate: selectedDayPredicate,
);
}
}
0