diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dff87c..ea10f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## [0.3.14+290.3.14-dev.1] - 2023-07-19 +## [0.3.14-dev.2] - 2023-07-20 +* new property 'wide' for controlling the width of the image +* property 'icon' now optional + +## [0.3.14-dev.1] - 2023-07-19 * Publishing as Pre-Release becaus of the depencency of a package with beta status diff --git a/README.md b/README.md index 704718f..1e636f9 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ The calendar view shows a list of events for the selected date. This list view s The property `isAllDay` has a higher priority than 'isMultiDay'. This means, that when you set `isAllDay` to `true` for an event, it will show up in the events list als all-day event without start and end times, no matter if `isMultiDay` was also set to `true`. +You can include images in calendar events. The property `icon` takes a String of the image name. This parameter is optional. + +To control the width of the image you can use the property `wide`, which is a bool. + ## Usage Embed the 'Calendar' widget in a column. Below the calendar (as the second widget in the Column) place a 'ListView.builder' widget for rendereing the list of events. diff --git a/example/lib/main.dart b/example/lib/main.dart index 0fe516f..33bb95f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -35,7 +35,6 @@ class _CalendarScreenState extends State { DateTime.now().year, DateTime.now().month, DateTime.now().day, 12, 0), description: 'A special event', color: Colors.blue[700], - icon: '', // assets/background.jpg ), ]; @@ -49,7 +48,6 @@ class _CalendarScreenState extends State { DateTime.now().day + 2, 12, 0), color: Colors.orange, isMultiDay: true, - icon: 'assets/background2.jpg', ), NeatCleanCalendarEvent( 'Allday Event B', @@ -61,6 +59,7 @@ class _CalendarScreenState extends State { color: Colors.pink, isAllDay: true, icon: 'assets/event1.jpg', + wideSpace: false ), NeatCleanCalendarEvent( 'Normal Event D', @@ -70,6 +69,7 @@ class _CalendarScreenState extends State { endTime: DateTime( DateTime.now().year, DateTime.now().month, DateTime.now().day, 17, 0), color: Colors.indigo, + wideSpace: true, icon: 'assets/events.jpg', ), NeatCleanCalendarEvent( @@ -80,6 +80,7 @@ class _CalendarScreenState extends State { endTime: DateTime( DateTime.now().year, DateTime.now().month, DateTime.now().day, 9, 0), color: Colors.indigo, + wideSpace: true, icon: 'assets/profile.jpg', ), ]; diff --git a/example/macos/Podfile b/example/macos/Podfile index dade8df..049abe2 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.11' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock deleted file mode 100644 index bf38dd6..0000000 --- a/example/macos/Podfile.lock +++ /dev/null @@ -1,22 +0,0 @@ -PODS: - - FlutterMacOS (1.0.0) - - macos_ui (0.1.0): - - FlutterMacOS - -DEPENDENCIES: - - FlutterMacOS (from `Flutter/ephemeral`) - - macos_ui (from `Flutter/ephemeral/.symlinks/plugins/macos_ui/macos`) - -EXTERNAL SOURCES: - FlutterMacOS: - :path: Flutter/ephemeral - macos_ui: - :path: Flutter/ephemeral/.symlinks/plugins/macos_ui/macos - -SPEC CHECKSUMS: - FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 - macos_ui: 125c911559d646194386d84c017ad6819122e2db - -PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c - -COCOAPODS: 1.11.3 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index f1f85ad..b0b6cdb 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -26,7 +26,6 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - C7F947AF03090AC7611F042F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CB0CF4D2BC5DDE426A2BF8A /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,7 +52,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0CB0CF4D2BC5DDE426A2BF8A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -68,11 +66,8 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 5B2C2EBDCD912CAE578511CB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 6846C44E1285B9F144CA71D0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - ECEC2B4131ECD73D7FB0760A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -80,7 +75,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C7F947AF03090AC7611F042F /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -104,8 +98,6 @@ 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - 5DA836F9E6D8DA21F8B5137D /* Pods */, ); sourceTree = ""; }; @@ -152,25 +144,6 @@ path = Runner; sourceTree = ""; }; - 5DA836F9E6D8DA21F8B5137D /* Pods */ = { - isa = PBXGroup; - children = ( - ECEC2B4131ECD73D7FB0760A /* Pods-Runner.debug.xcconfig */, - 6846C44E1285B9F144CA71D0 /* Pods-Runner.release.xcconfig */, - 5B2C2EBDCD912CAE578511CB /* Pods-Runner.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 0CB0CF4D2BC5DDE426A2BF8A /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -178,13 +151,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 1439F9629852231FDD0331AF /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - FF68416EC895F4E014097AEE /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -254,30 +225,9 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1439F9629852231FDD0331AF /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -313,23 +263,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - FF68416EC895F4E014097AEE /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -404,7 +337,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -483,7 +416,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -530,7 +463,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/example/pubspec.lock b/example/pubspec.lock index e1dbee4..d130b7b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -68,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "0.3.14-dev.1" + version: "0.3.14-dev.2" flutter_test: dependency: "direct dev" description: flutter diff --git a/lib/calendar_tile.dart b/lib/calendar_tile.dart index aef7d96..dee5ecc 100644 --- a/lib/calendar_tile.dart +++ b/lib/calendar_tile.dart @@ -107,10 +107,10 @@ class NeatCleanCalendarTile extends StatelessWidget { : selectedColor : Theme.of(context).primaryColor, image: events != null && events!.isNotEmpty - ? icon != '' + ? icon != '' && icon != null ? DecorationImage( fit: BoxFit.cover, - image: providerImage(icon), + image: providerImage(icon!), ) : null : null, @@ -120,10 +120,10 @@ class NeatCleanCalendarTile extends StatelessWidget { : events!.isNotEmpty ? BoxDecoration( shape: BoxShape.circle, - image: icon != '' + image: icon != '' && icon != null ? DecorationImage( fit: BoxFit.cover, - image: providerImage(icon), + image: providerImage(icon!), ) : null, ) @@ -198,14 +198,13 @@ class NeatCleanCalendarTile extends StatelessWidget { } } - String get icon => events! + String? get icon => events! .firstWhere( (element) => Utils.isSameDay(this.date!, element.startTime), orElse: () => NeatCleanCalendarEvent( '', startTime: this.date!, endTime: this.date!, - icon: '', ), ) .icon; diff --git a/lib/flutter_neat_and_clean_calendar.dart b/lib/flutter_neat_and_clean_calendar.dart index 7e8a656..6f80f45 100644 --- a/lib/flutter_neat_and_clean_calendar.dart +++ b/lib/flutter_neat_and_clean_calendar.dart @@ -639,17 +639,19 @@ class _CalendarState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - flex: 25, + flex: event.wide != null && event.wide! == true + ? 25 + : 5, child: Padding( padding: const EdgeInsets.all(4.0), child: Container( decoration: BoxDecoration( color: event.color, borderRadius: BorderRadius.circular(10), - image: event.icon != '' + image: event.icon != '' && event.icon != null ? DecorationImage( fit: BoxFit.cover, - image: providerImage(event.icon), + image: providerImage(event.icon!), ) : null, ), diff --git a/lib/neat_and_clean_calendar_event.dart b/lib/neat_and_clean_calendar_event.dart index 615087f..55e409a 100644 --- a/lib/neat_and_clean_calendar_event.dart +++ b/lib/neat_and_clean_calendar_event.dart @@ -18,7 +18,8 @@ class NeatCleanCalendarEvent { MultiDaySegement? multiDaySegement; bool isDone; Map? metadata; - String icon; + String? icon; + bool? wide = false; NeatCleanCalendarEvent( this.summary, { @@ -32,6 +33,7 @@ class NeatCleanCalendarEvent { this.isDone = false, multiDaySegement, this.metadata, - required this.icon, + this.icon, + this.wide, }); } diff --git a/pubspec.yaml b/pubspec.yaml index 2ec9ef6..3ecfa53 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.3.14-dev.1 +version: 0.3.14-dev.2 homepage: https://github.com/rwbr/flutter_neat_and_clean_calendar environment: