1. Tag Results
custom-builder (4)
1 - 4 of 4
How to customize the month cell with appointment count in the Flutter Calendar
In the Flutter Event Calendar, you can customize the calendar month cell with appointment count by using the monthCellBuilder property of the calendar. Use the required widget for cell customization with appointments count by using the MonthCellDetails. Note:Appointments will display on month cell builder widgets based on the appointment display mode.    Widget monthCellBuilder(BuildContext context, MonthCellDetails details) {   var length = details.appointments.length;   if (details.appointments.isNotEmpty) {     return Container(       child: Column(         children: <Widget>[           Column(             mainAxisAlignment: MainAxisAlignment.center,             children: [               Text(                 details.date.day.toString(),                 textAlign: TextAlign.center,               ),               Divider(color: Colors.transparent,),               Text(                 '$length',                 textAlign: TextAlign.center,                 style: TextStyle(color: Colors.deepPurple),               ),               Divider(color: Colors.transparent,),               Icon(                 Icons.event_available_rounded,                 color: Colors.red,                 size: 20,               ),             ],           )         ],       ),     );   }   return Container(     child: Text(       details.date.day.toString(),       textAlign: TextAlign.center,     ),   ); } Assign the customized widget to the monthCellBuilder property of the Flutter event calendar. child: SfCalendar(   view: CalendarView.month,   monthCellBuilder: monthCellBuilder,   monthViewSettings: MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.none),   dataSource: _getCalendarDataSource(), ), View sample in GitHub  
How to select all days when clicking on the day header in the Flutter Date Range Picker (SfDateRangePicker)?
In the Flutter Date Range Picker, you can customize the date range picker cells using the cellBuilder property. STEP 1: Use the required widget for cell customization. In this sample Text and Icon Widget used for customization. Widget cellBuilder(     BuildContext context, DateRangePickerCellDetails cellDetails) {   if (_controller.view == DateRangePickerView.month) {     return Column(       children: [         Container(           child: Icon(             Icons.wb_sunny,             color: Colors.yellow,           ),         ),         Container(           child: Text(DateFormat('dd').format(cellDetails.date)),         )       ],     );   } else if (_controller.view == DateRangePickerView.year) {     return Column(       children: [         Container(           child: Icon(             Icons.wb_sunny,             color: Colors.yellow,           ),         ),         Container(           child: Text(DateFormat('MMM').format(cellDetails.date)),         )       ],     );   } else if (_controller.view == DateRangePickerView.decade) {     return Column(       children: [         Container(           child: Icon(             Icons.wb_sunny,             color: Colors.yellow,           ),         ),         Container(           child: Text(DateFormat('yyy').format(cellDetails.date)),         )       ],     );   } else {     final int yearValue = cellDetails.date.year;     return Column(       children: [         Container(           child: Icon(             Icons.wb_sunny,             color: Colors.yellow,           ),         ),         Container(           child:               Text(yearValue.toString() + ' - ' + (yearValue + 9).toString()),         )       ],     );   } } STEP 2: Assign customized widget to the cellBuilder property of the Flutter date range picker. child: SfDateRangePicker(   view: DateRangePickerView.month,   controller: _controller,   cellBuilder: cellBuilder, ), View sample in GitHub          Month view            Year view             Decade view            Century view  ConclusionI hope you enjoyed learning about how to select all days when clicking on the day header in the Flutter Date Range Picker (SfDateRangePicker).You can refer to our Flutter DateRangePicker feature tour page to know about its other groundbreaking feature representations documentation and how to quickly get started for configuration specifications.  You can also explore our Flutter Date Range Picker example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to customize the appointments using custom builder in the Flutter Calendar
In the Flutter Event Calendar, you can add the custom builder for appointments by using the appointmentBuilder property of the calendar. STEP 1: You can use any widget for appointment builder. Here we are using Text and Icon widget for customization. Widget appointmentBuilder(BuildContext context,     CalendarAppointmentDetails calendarAppointmentDetails) {   final Appointment appointment =       calendarAppointmentDetails.appointments.first;   return Column(     children: [       Container(           width: calendarAppointmentDetails.bounds.width,           height: calendarAppointmentDetails.bounds.height / 2,           color: appointment.color,           child: Center(             child: Icon(               Icons.group,               color: Colors.black,             ),           )),       Container(         width: calendarAppointmentDetails.bounds.width,         height: calendarAppointmentDetails.bounds.height / 2,         color: appointment.color,         child: Text(           appointment.subject +               DateFormat(' (hh:mm a').format(appointment.startTime) +               '-' +               DateFormat('hh:mm a)').format(appointment.endTime),           textAlign: TextAlign.center,style: TextStyle(fontSize: 10),         ),       )     ],   ); }   STEP 2: Assign that widget to the appointmentBuilder property of the calendar.   child: SfCalendar(   view: CalendarView.week,   allowedViews: <CalendarView>[     CalendarView.day,     CalendarView.workWeek,     CalendarView.week,     CalendarView.month,     CalendarView.timelineDay,     CalendarView.timelineWeek,     CalendarView.timelineWorkWeek,     CalendarView.timelineMonth,     CalendarView.schedule   ],   dataSource: _getCalendarDataSource(),   monthViewSettings: MonthViewSettings(showAgenda: true),   timeSlotViewSettings:       TimeSlotViewSettings(timelineAppointmentHeight: 100),   appointmentBuilder: appointmentBuilder, )), View sample in GitHub                 
How to customize the special time region using custom builder in the Flutter Calendar
In the Flutter Event Calendar, you can use the custom builder for the special time region by using the timeRegionBuilder property of the calendar. STEP1: You can use any widget for special time region. Here we are using Icon widget for customization. Widget timeRegionBuilder(     BuildContext context, TimeRegionDetails timeRegionDetails) {   if (timeRegionDetails.region.text == "Lunch") {     return Container(       color: timeRegionDetails.region.color,       alignment: Alignment.center,       child: Icon(         Icons.restaurant,         color: Colors.grey.withOpacity(0.5),       ),     );   } else if (timeRegionDetails.region.text == "WeekEnd") {     return Container(       color: timeRegionDetails.region.color,       alignment: Alignment.center,       child: Icon(         Icons.weekend,         color: Colors.grey.withOpacity(0.5),       ),     );   } } STEP 2: Assign the widget to the timeRegionBuilder property of the calendar.   child: SfCalendar(   view: CalendarView.week,   specialRegions: _getTimeRegions(),   timeRegionBuilder: timeRegionBuilder, )), List<TimeRegion> _getTimeRegions() {   final List<TimeRegion> regions = <TimeRegion>[];   DateTime date = DateTime.now();   regions.add(TimeRegion(     startTime: DateTime(2020, 12, 15, 13, 0, 0),     endTime: DateTime(2020, 12, 15, 14, 0, 0),     enablePointerInteraction: true,     color: Colors.grey.withOpacity(0.2),     recurrenceRule: 'FREQ=DAILY;INTERVAL=1',     text: 'Lunch',   ));   regions.add(TimeRegion(     startTime: DateTime(2020, 12, 15, 00, 0, 0),     endTime: DateTime(2020, 12, 15, 24, 0, 0),     recurrenceRule: 'FREQ=WEEKLY;INTERVAL=1;BYDAY=SAT,SUN',     color: Color(0xffbD3D3D3),     text: 'WeekEnd',   ));   return regions; } View sample in GitHub        
No articles found
No articles found
1 of 1 pages (4 items)