Skip to content

Commit

Permalink
feat(pub): New property wide for NetAndCleqanCalendarEvent
Browse files Browse the repository at this point in the history
* property icon now optional
  • Loading branch information
agfeo-rw committed Jul 20, 2023
1 parent 129822c commit ec9a35e
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 111 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class _CalendarScreenState extends State<CalendarScreen> {
DateTime.now().year, DateTime.now().month, DateTime.now().day, 12, 0),
description: 'A special event',
color: Colors.blue[700],
icon: '', // assets/background.jpg
),
];

Expand All @@ -49,7 +48,6 @@ class _CalendarScreenState extends State<CalendarScreen> {
DateTime.now().day + 2, 12, 0),
color: Colors.orange,
isMultiDay: true,
icon: 'assets/background2.jpg',
),
NeatCleanCalendarEvent(
'Allday Event B',
Expand All @@ -61,6 +59,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
color: Colors.pink,
isAllDay: true,
icon: 'assets/event1.jpg',
wideSpace: false
),
NeatCleanCalendarEvent(
'Normal Event D',
Expand All @@ -70,6 +69,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
endTime: DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day, 17, 0),
color: Colors.indigo,
wideSpace: true,
icon: 'assets/events.jpg',
),
NeatCleanCalendarEvent(
Expand All @@ -80,6 +80,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
endTime: DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day, 9, 0),
color: Colors.indigo,
wideSpace: true,
icon: 'assets/profile.jpg',
),
];
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
22 changes: 0 additions & 22 deletions example/macos/Podfile.lock

This file was deleted.

77 changes: 5 additions & 72 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand All @@ -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 */
Expand All @@ -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 = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -68,19 +66,15 @@
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C7F947AF03090AC7611F042F /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -104,8 +98,6 @@
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
5DA836F9E6D8DA21F8B5137D /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -152,39 +144,18 @@
path = Runner;
sourceTree = "<group>";
};
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 = "<group>";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
0CB0CF4D2BC5DDE426A2BF8A /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
33CC10EC2044A3C60003C045 /* Runner */ = {
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 = (
);
Expand Down Expand Up @@ -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 = (
);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions lib/calendar_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions lib/flutter_neat_and_clean_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,19 @@ class _CalendarState extends State<Calendar> {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
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,
),
Expand Down
6 changes: 4 additions & 2 deletions lib/neat_and_clean_calendar_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class NeatCleanCalendarEvent {
MultiDaySegement? multiDaySegement;
bool isDone;
Map<String, dynamic>? metadata;
String icon;
String? icon;
bool? wide = false;

NeatCleanCalendarEvent(
this.summary, {
Expand All @@ -32,6 +33,7 @@ class NeatCleanCalendarEvent {
this.isDone = false,
multiDaySegement,
this.metadata,
required this.icon,
this.icon,
this.wide,
});
}
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.3.14-dev.1
version: 0.3.14-dev.2
homepage: https://github.com/rwbr/flutter_neat_and_clean_calendar

environment:
Expand Down

0 comments on commit ec9a35e

Please sign in to comment.