loadMoreWidgetBuilder property

LoadMoreWidgetBuilder? loadMoreWidgetBuilder
final

A builder that sets the widget to display on the calendar widget when the appointments are being loaded.

This callback will be called when a view or resource collection changed, and when calendar reaches start or end scroll position in schedule view. With this builder, you can set widget and then initiate the process of loading more appointments by calling ‘loadMoreAppointments’ callback which is passed as a parameter to this builder. The ‘loadMoreAppointments’ will in turn call the [CalendarDataSource.handleLoadMore' method, where you have to load the appointments.

The widget returned from this builder will be rendered based on calendar widget width and height.

Note: This callback will be called after the onViewChanged callback. The widget returned from this builder will be removed from SfCalendar when CalendarDataSource.notifyListeners is called.

See also:

@override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       body: SfCalendar(
           controller: _controller,
           dataSource: _dataSource(),
           loadMoreWidgetBuilder: (BuildContext context,
                  LoadMoreCallback loadMoreAppointments) {
             return FutureBuilder<void>(
               initialData: 'loading',
               future: loadMoreAppointments(),
               builder: (context, snapShot) {
                   return Container(
                       height: _controller.view == CalendarView.schedule
                          ? 50
                          : double.infinity,
                       width: double.infinity,
                       color: Colors.white38,
                       alignment: Alignment.center,
                       child: CircularProgressIndicator(
                           valueColor:
                              AlwaysStoppedAnimation(Colors.deepPurple)));
               },
             );
           },
     ),
   );
 }

Implementation

final LoadMoreWidgetBuilder? loadMoreWidgetBuilder;