Closed bartazini closed 2 months ago
So you want two new properties to be added to widget API to style the text of a list cell? I could do that. But did you recognize, that there is a property called eventListBuilder
(https://github.com/rwbr/flutter_neat_and_clean_calendar?tab=readme-ov-file#eventlistbuilder).
With this property you can define a widget, that creates the whole list of events according to your wishes. See eventList
:
/// Returns a widget representing the event list.
///
/// This widget is used to display a list of events.
/// It can be used to show events for a specific date or a range of dates.
/// The events can be customized and styled according to the application's needs.
/// To use this widget, simply call the `eventList` getter and include it in your widget tree.
Widget get eventList {
// If eventListBuilder is provided, use it to build the list of events to show.
// Otherwise use the default list of events.
if (widget.eventListBuilder == null) {
return Expanded(
child: _selectedEvents != null && _selectedEvents!.isNotEmpty
// Create a list of events that are occurring on the currently selected day, if there are
// any. Otherwise, display an empty Container.
? ListView.builder(
padding: EdgeInsets.all(0.0),
itemBuilder: (BuildContext context, int index) {
final NeatCleanCalendarEvent event = _selectedEvents![index];
final String start =
DateFormat('HH:mm').format(event.startTime).toString();
final String end =
DateFormat('HH:mm').format(event.endTime).toString();
return eventCell(event, start, end);
},
itemCount: _selectedEvents!.length,
)
: Container(),
);
} else {
// eventListBuilder is not null
return widget.eventListBuilder!(context, _selectedEvents!);
}
}
Of course you have to define your own eventCell
method. But you can do every kind of customization of the list right now without any change of the library by defining you own custom list widget.
Regarding you suggestion:
I consider to add another property to the library, that lets the users define their own eventCell
widget. Setting the text style alone is too inflexible.
Im facing the issue with not visible text in the events section:
Could we make style properties for event element configurable from the Calendar class level? Example - bodyLarge and bodyMedium are already used in other view and I can not change them without breaking other application parts