Line data Source code
1 : import 'package:alh_calendar/models/calendar_day_builder_model.dart'; 2 : import 'package:alh_calendar/widgets/alh_calendar.dart'; 3 : import 'package:flutter/material.dart'; 4 : 5 : class CalendarCell extends StatelessWidget { 6 : final DateTime date; 7 : final bool isInCurrentMonth; 8 : final bool isSelected; 9 : final bool isWeekend; 10 : final bool isOutOfRange; 11 : final DayBuilder dayBuilder; 12 : final bool isSixthRowAndDisabled; 13 : final VoidCallback? onTap; 14 : 15 4 : const CalendarCell({ 16 : required this.date, 17 : required this.isInCurrentMonth, 18 : required this.isSelected, 19 : required this.isWeekend, 20 : required this.dayBuilder, 21 : required this.onTap, 22 : required this.isOutOfRange, 23 : required this.isSixthRowAndDisabled, 24 : super.key, 25 : }); 26 : 27 3 : @override 28 : Widget build(BuildContext context) { 29 3 : bool isSelected = this.isSelected; 30 3 : if (this.isSixthRowAndDisabled) { 31 : isSelected = false; 32 : } 33 : 34 3 : final calendarDayBuilderModel = CalendarDayBuilderModel( 35 6 : dateTime: this.isSixthRowAndDisabled ? null : this.date, 36 3 : isInCurrentMonth: this.isInCurrentMonth, 37 : isSelected: isSelected, 38 3 : isWeekend: this.isWeekend, 39 3 : isOutOfRange: this.isOutOfRange, 40 : ); 41 : 42 3 : return InkWell( 43 : splashColor: Colors.transparent, 44 : highlightColor: Colors.transparent, 45 6 : onTap: this.isSixthRowAndDisabled ? null : this.onTap, 46 6 : child: this.dayBuilder(calendarDayBuilderModel), 47 : ); 48 : } 49 : }