Skip to content

Commit

Permalink
Merge pull request #245 from DhavalRKansara/master
Browse files Browse the repository at this point in the history
fix: 🐛 Event overlapping issue fixed in daily view #219
  • Loading branch information
PRBaraiya authored Aug 4, 2023
2 parents a39141c + bceab41 commit e87beaf
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: flutter pub get

- name: Formatting check
run: flutter format . --dry-run --set-exit-if-changed
run: dart format . --set-exit-if-changed

- name: Analyse
run: flutter analyze
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [1.0.4 - 4 Aug 2023](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.4)
- Fixed
Issue [#219 - There is an issue with the daily view layout display](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/219)

# [1.0.3 - 3 Apr 2023](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.3)
- Added
Feature [#172 - Press Detector builder for day view and week view](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/172)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ Above code will create `WeekView` with only five days, from monday to friday.
<td align="center"><a href="https://github.com/AnkitPanchal10"><img src="https://avatars.githubusercontent.com/u/38405884?s=100" width="100px;" alt=""/><br /><sub><b>Ankit Panchal</b></sub></a></td>
<td align="center"><a href="https://github.com/MehulKK"><img src="https://avatars.githubusercontent.com/u/60209725?s=100" width="100px;" alt=""/><br /><sub><b>Mehul Kabaria</b></sub></a></td>
<td align="center"><a href="https://github.com/faiyaz-shaikh"><img src="https://avatars.githubusercontent.com/u/89002539?v=4" width="100px;" alt=""/><br /><sub><b>Faiyaz Shaikh</b></sub></a></td>
<td align="center"><a href="https://github.com/DhavalRKansara"><img
src="https://avatars.githubusercontent.com/u/44993081?v=4" width="100px;"
alt=""/><br /><sub><b>Dhaval Kansara</b></sub></a></td>
</tr>
</table>
<br/>
Expand Down
97 changes: 5 additions & 92 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,99 +10,12 @@ analyzer:

linter:
rules:
lines_longer_than_80_chars: true
public_member_api_docs: false
avoid_print: true
always_declare_return_types: true
avoid_equals_and_hash_code_on_mutable_classes: true
use_function_type_syntax_for_parameters: true
unnecessary_new: true
unnecessary_brace_in_string_interps: true
unnecessary_this: true
avoid_bool_literals_in_conditional_expressions: true
unnecessary_null_in_if_null_operators: true
unnecessary_null_checks: true
unnecessary_null_aware_assignments: true
unrelated_type_equality_checks: true
unnecessary_statements: true
throw_in_finally: true
test_types_in_equals: true
prefer_void_to_null: true
prefer_relative_imports: true
no_logic_in_create_state: true
no_duplicate_case_values: true
avoid_dynamic_calls: true
avoid_empty_else: true
avoid_relative_lib_imports: true
avoid_type_to_string: true
avoid_slow_async_io: true
annotate_overrides: true
cancel_subscriptions: true
close_sinks: true
empty_statements: true
empty_constructor_bodies: true
hash_and_equals: true
iterable_contains_unrelated_type: true
list_remove_unrelated_type: true
literal_only_boolean_expressions: true
always_require_non_null_named_parameters: true
omit_local_variable_types: true
annotate_overrides: true
avoid_init_to_null: true
avoid_js_rounded_ints: true
avoid_redundant_argument_values: true
avoid_renaming_method_parameters: true
avoid_return_types_on_setters: true
avoid_returning_null_for_void: true
avoid_single_cascade_in_expression_statements: true
avoid_types_on_closure_parameters: true
avoid_unnecessary_containers: true
avoid_unused_constructor_parameters: true
avoid_void_async: true
await_only_futures: true
camel_case_extensions: true
camel_case_types: true
cascade_invocations: true
cast_nullable_to_non_nullable: true
deprecated_consistency: true
provide_deprecation_message: true
directives_ordering: true
exhaustive_cases: true
file_names: true
library_names: true
library_prefixes: true
no_default_cases: true
no_runtimeType_toString: true
non_constant_identifier_names: true
prefer_adjacent_string_concatenation: true
prefer_asserts_with_message: true
prefer_collection_literals: true
prefer_conditional_assignment: true
prefer_const_constructors_in_immutables: true
prefer_contains: true
prefer_equal_for_default_values: true
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_final_fields: true
prefer_generic_function_type_aliases: true
prefer_if_null_operators: true
prefer_if_elements_to_conditional_expressions: true
prefer_initializing_formals: true
prefer_interpolation_to_compose_strings: true
prefer_is_empty: true
prefer_is_not_operator: true
prefer_iterable_whereType: true
prefer_null_aware_operators: true
recursive_getters: true
slash_for_doc_comments: true
type_annotate_public_apis: true
unnecessary_await_in_return: true
unnecessary_const: true
unnecessary_getters_setters: true
unnecessary_lambdas: true
unnecessary_string_escapes: true
unnecessary_string_interpolations: true
use_full_hex_values_for_flutter_colors: true
use_if_null_to_convert_nulls_to_bools: true
use_is_even_rather_than_modulo: true
use_named_constants: true
use_rethrow_when_possible: true
use_key_in_widget_constructors: false
avoid_positional_boolean_parameters: false
use_super_parameters: true
prefer_relative_imports: true
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
13 changes: 8 additions & 5 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -127,7 +127,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -171,10 +171,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -185,6 +187,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -272,7 +275,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -346,7 +349,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -395,7 +398,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions lib/src/components/common_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class CalendarPageHeader extends StatelessWidget {
this.onPreviousDay,
this.secondaryDate,
@Deprecated("Use Header Style to provide background")
this.backgroundColor = Constants.headerBackground,
this.backgroundColor = Constants.headerBackground,
@Deprecated("Use Header Style to provide icon color")
this.iconColor = Constants.black,
this.iconColor = Constants.black,
this.headerStyle = const HeaderStyle(),
}) : super(key: key);

Expand Down
21 changes: 12 additions & 9 deletions lib/src/event_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ class EventController<T extends Object?> extends ChangeNotifier {
if (_calendarData.eventList.contains(event)) return;
if (event.endDate.difference(event.date).inDays > 0) {
if (event.startTime!.isDayStart && event.endTime!.isDayStart) {
_calendarData.fullDayEventList.add(event);
_calendarData.fullDayEventList.addEventInSortedManner(event);
} else {
_calendarData.rangingEventList.add(event);
_calendarData.rangingEventList.addEventInSortedManner(event);
}
} else {
final date = event.date.withoutTime;
Expand All @@ -172,7 +172,7 @@ class EventController<T extends Object?> extends ChangeNotifier {
date: [event],
});
} else {
_calendarData.events[date]!.add(event);
_calendarData.events[date]!.addEventInSortedManner(event);
}
}

Expand All @@ -185,15 +185,18 @@ class EventController<T extends Object?> extends ChangeNotifier {
}

class CalendarData<T> {
// Stores events that occurs only once in a map.
final events = <DateTime, List<CalendarEventData<T>>>{};

// Stores all the events in a list.
// Stores all the events in a list(all the items in below 3 list will be
// available in this list as global itemList of all events).
final eventList = <CalendarEventData<T>>[];

// Stores all the ranging events in a list.
// Stores events that occurs only once in a map, Here the key will a day
// and along to the day as key we will store all the events of that day as
// list as value
final events = <DateTime, List<CalendarEventData<T>>>{};

// Stores all the ranging events in a list
final rangingEventList = <CalendarEventData<T>>[];

// Stores all full day events
// Stores all full day events(24hr event)
final fullDayEventList = <CalendarEventData<T>>[];
}
20 changes: 20 additions & 0 deletions lib/src/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,23 @@ extension MinutesExtension on MinuteSlotSize {
}
}
}

extension MyList on List<CalendarEventData> {
// Below function will add the new event in sorted manner(startTimeWise) in
// the existing list of CalendarEventData.
void addEventInSortedManner(CalendarEventData event) {
var addIndex = -1;
for (var i = 0; i < this.length; i++) {
if (event.startTime!.compareTo(this[i].startTime!) <= 0) {
addIndex = i;
break;
}
}

if (addIndex > -1) {
this.insert(addIndex, event);
} else {
this.add(event);
}
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: calendar_view
description: A Flutter package allows you to easily implement all calendar UI and calendar event functionality.
version: 1.0.3
version: 1.0.4
homepage: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view
issue_tracker: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues?q=is%3Aissue+is%3Aopen+label%3Abug

Expand Down

0 comments on commit e87beaf

Please sign in to comment.