monthButtonBuilder property

WidgetCbMonthButton? monthButtonBuilder
final

Build your own month buttons

  • NOTE: COPY & PASTE
  • Sample code

 monthButtonBuilder: (dateTime,childHeight,childWidth,isSelected,isDisabled,hasEvent,isHighlighted,isCurrentDay) {
                   //Text Theme
                   final txtTheme = Theme.of(context).textTheme;
                   //color theme
                   final colorTheme = Theme.of(context);

                   var daysText = Align(
                     child: Text(
                       '${dateTime.day}',
                       style: isDisabled
                           ? txtTheme.caption
                           : isSelected
                               ? txtTheme.bodyText1!.copyWith(
                                   fontWeight: FontWeight.bold,
                                   color:
                                       colorTheme.brightness == Brightness.dark
                                           ? Colors.black
                                           : Colors.white)
                               : isHighlighted
                                   ? txtTheme.bodyText2 //Highlighted TextStyle
                                   : isCurrentDay
                                       ? txtTheme
                                           .bodyText2 //CurrentDay TextStyle
                                       : txtTheme.bodyText2,
                     ),
                   );
                   return Stack(
                     children: [
                       //if button is Enabled or Disabled
                       isDisabled || !isSelected
                           ? CustomPaint(
                               painter: CirclePainter(
                                 color: isDisabled
                                     ? colorTheme.disabledColor
                                         .withOpacity(0.03)
                                     : isHighlighted
                                         ? colorTheme.accentColor
                                         : isCurrentDay
                                             ? colorTheme.accentColor
                                                 .withOpacity(0.5)
                                             : colorTheme.disabledColor
                                                 .withOpacity(0.05),
                                 style: isDisabled
                                     ? PaintingStyle.fill
                                     : isHighlighted
                                         ? PaintingStyle.stroke
                                         : isCurrentDay
                                             ? PaintingStyle.fill
                                             : PaintingStyle.stroke,
                                 strokeWidth: 1,
                                 radius: childHeight / 2,
                               ),
                               child: daysText,
                             )
                           //if button is Selected
                           : Align(
                               child: SizedBox(
                                 height: childHeight,
                                 width: childWidth,
                                 child: TweenAnimationBuilder<Decoration>(
                                   duration: const Duration(milliseconds: 200),
                                   tween: DecorationTween(
                                     begin: BoxDecoration(
                                         color: colorTheme.accentColor,
                                         shape: BoxShape.circle,
                                         boxShadow: [
                                           BoxShadow(
                                             blurRadius: 5,
                                             color: colorTheme.accentColor
                                                 .withOpacity(0.6),
                                             spreadRadius: 3,
                                           ),
                                         ]),
                                     end: BoxDecoration(
                                       color: colorTheme.accentColor,
                                       shape: BoxShape.circle,
                                     ),
                                   ),
                                   builder: (context, value, child) =>
                                       DecoratedBox(
                                     decoration: value,
                                     child: daysText,
                                   ),
                                 ),
                               ),
                             ),
                       //event button
                       if (hasEvent)
                         Align(
                           alignment: Alignment.bottomCenter,
                           child: CustomPaint(
                             painter: CirclePainter(
                               color: isDisabled
                                   ? colorTheme.disabledColor.withOpacity(0.05)
                                   : colorTheme.accentColor,
                               style: PaintingStyle.fill,
                               strokeWidth: 0,
                               radius: 3,
                               offset: const Offset(0, -4),
                             ),
                           ),
                         ),
                     ],
                   );
                 },

{@end-tool}

Implementation

final WidgetCbMonthButton? monthButtonBuilder;