From 2a5dcb81ffd68b5671f0d9d615d12778b0b0ce6d Mon Sep 17 00:00:00 2001 From: Ralf Weinbrecher Date: Mon, 12 Aug 2024 15:59:35 +0200 Subject: [PATCH] feat(calendar): New parameter showEventListViewIcon to hide the list view icon --- CHANGELOG.md | 3 +++ README.md | 7 +++++++ example/ios/Podfile.lock | 2 +- example/lib/main.dart | 1 + lib/flutter_neat_and_clean_calendar.dart | 16 ++++++++++++++-- pubspec.yaml | 2 +- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d3c66..3c00e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 17a8186..9c21c4f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 042aaa1..88a2a34 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 -COCOAPODS: 1.15.2 +COCOAPODS: 1.13.0 diff --git a/example/lib/main.dart b/example/lib/main.dart index bb5c669..929a173 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -191,6 +191,7 @@ class _CalendarScreenState extends State { datePickerType: DatePickerType.date, dayOfWeekStyle: TextStyle( color: Colors.red, fontWeight: FontWeight.w800, fontSize: 11), + showEventListViewIcon: true, showEvents: showEvents, ), ), diff --git a/lib/flutter_neat_and_clean_calendar.dart b/lib/flutter_neat_and_clean_calendar.dart index 231fcf1..294f3b6 100644 --- a/lib/flutter_neat_and_clean_calendar.dart +++ b/lib/flutter_neat_and_clean_calendar.dart @@ -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 @@ -195,6 +196,7 @@ class Calendar extends StatefulWidget { this.datePickerConfig, this.eventTileHeight, this.showEventListView = false, + this.showEventListViewIcon = true, this.showEvents = true}); @override @@ -220,7 +222,12 @@ class _CalendarState extends State { 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 @@ -476,6 +483,8 @@ class _CalendarState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ showEventListView ? Container() : leftArrow ?? Container(), + widget.showEventListViewIcon + ? PlatformIconButton( onPressed: () { setState(() { @@ -491,7 +500,10 @@ class _CalendarState extends State { Icons.list, color: widget.topRowIconColor, ), - ), + ) + : Container( + padding: EdgeInsets.only(left: 24.0), + ), showEventListView ? Flexible( child: Container(), diff --git a/pubspec.yaml b/pubspec.yaml index c74c844..50c2b9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: