Skip to content

Commit

Permalink
feat(calendar): New parameter showEventListViewIcon to hide the list …
Browse files Browse the repository at this point in the history
…view icon
  • Loading branch information
agfeo committed Aug 12, 2024
1 parent ecd106d commit 2a5dcb8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.4.7] - 2024-08-12
* New parameter showEventListViewIcon to hide the list view icon

## [0.4.6] - 2024-08-12
* New callback for logging

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@ final bool showEventListView;
````
With this `bool` parameter you can switch the view to a list of events only. If set to `true` the calendar grid gets hidden.

#### `showEventListViewIcon`

```dart
final bool showEventListViewIcon;
````
With this `bool` parameter you can control if the widget will display the list view icon. If the list view icon is hidden, the list view feature is disabled.

### Setting the calendar events

```dart
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.15.2
COCOAPODS: 1.13.0
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
datePickerType: DatePickerType.date,
dayOfWeekStyle: TextStyle(
color: Colors.red, fontWeight: FontWeight.w800, fontSize: 11),
showEventListViewIcon: true,
showEvents: showEvents,
),
),
Expand Down
16 changes: 14 additions & 2 deletions lib/flutter_neat_and_clean_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class Calendar extends StatefulWidget {
final double? eventTileHeight;
final bool showEvents;
final bool showEventListView;
final bool showEventListViewIcon;

/// Configures the date picker if enabled
Expand Down Expand Up @@ -195,6 +196,7 @@ class Calendar extends StatefulWidget {
this.datePickerConfig,
this.eventTileHeight,
this.showEventListView = false,
this.showEventListViewIcon = true,
this.showEvents = true});

@override
Expand All @@ -220,7 +222,12 @@ class _CalendarState extends State<Calendar> {
super.initState();

isExpanded = widget.isExpanded;
showEventListView = widget.showEventListView;

if (widget.showEventListViewIcon == true) {
showEventListView = widget.showEventListView;
} else {
showEventListView = false;
}
// When setting the initial date, the eventsmap must be updated. The eventsmap is used to
// store the events for each day. The eventsmap is used to display the events in the calendar.
// It is basically the internal store of the events. Because the events are passed as a list
Expand Down Expand Up @@ -476,6 +483,8 @@ class _CalendarState extends State<Calendar> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
showEventListView ? Container() : leftArrow ?? Container(),
widget.showEventListViewIcon
?
PlatformIconButton(
onPressed: () {
setState(() {
Expand All @@ -491,7 +500,10 @@ class _CalendarState extends State<Calendar> {
Icons.list,
color: widget.topRowIconColor,
),
),
)
: Container(
padding: EdgeInsets.only(left: 24.0),
),
showEventListView
? Flexible(
child: Container(),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: >-
Simple and clean flutter calendar with ability to slide up/down to show
weekly/monthly calendar. Fork of
https://pub.dev/packages/flutter_clean_calendar
version: 0.4.6
version: 0.4.7
homepage: https://github.com/rwbr/flutter_neat_and_clean_calendar

environment:
Expand Down

0 comments on commit 2a5dcb8

Please sign in to comment.