Skip to content

Commit 8ae3edd

Browse files
authored
Merge pull request #139 from SimformSolutionsPvtLtd/develop
Fixed issue and feature for next release
2 parents ae25c1b + 91a8a53 commit 8ae3edd

23 files changed

+452
-231
lines changed

CHANGELOG.md

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [1.0.1 - 25 Nov 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.1)
2+
- Added
3+
Feature [#26 - Support for locale](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/26)
4+
- Added removeWhere method in `EventController` to conditionally remove multiple events. (Fixes
5+
Issue [#31](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/31))
6+
- Added customization in calendar views and
7+
closes [#34](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/34).
8+
- Added Customizations in `DayView`. Adds `dateStringBuilder`, `timeStringBuilder`, `headerStyle`
9+
parameters in `Dayview`,
10+
- Added Customizations in `MonthView`. Adds `headerStringBuilder`, `dateStringBuilder`
11+
, `weekDayStringBuilder`, `headerStyle` parameters in `WeekView`.
12+
- Added Customizations in `WeekView`. Adds `headerStyle`, `headerStringBuilder`
13+
, `timeLineStringBuilder`, `weekDayStringBuilder`, `weekDayDateStringBuilder` parameters
14+
in `WeekView`,
15+
- Added onTap lister in day and week views. issue #50.
16+
- Updates calculation of day difference. issue #80, #97.
17+
- Fixed
18+
Issue [#93 - Showing only 1 day in DayView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/93)
19+
- Fixed
20+
Issue [#130 - Week view incorrectly displays events when a day contains overlapping events](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/130)
21+
122
# [1.0.0 - 12 Aug 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.0)
223

324
- **Breaking Changes**
@@ -6,56 +27,56 @@
627
Note: This changes the behaviour of comparing two events using `==` operator. Please test your
728
app properly after updating to this version.
829

9-
- Add 15,30 and 60 minutes slots for `onDateLongPress` callback in Week and Day view.
10-
- Add method to update filter in `EventController`.
30+
- Added 15,30 and 60 minutes slots for `onDateLongPress` callback in Week and Day view.
31+
- Added method to update filter in `EventController`.
1132
- Restructured the logic to store single time events.
12-
- Add method to scroll to an event.
33+
- Added method to scroll to an event.
1334
Issue [#30 - Scroll to an event in day view](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/30)
1435
- Added
15-
feature [#36 - Feature/custom strings](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/36)
36+
Feature [#36 - Feature/custom strings](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/36)
1637
- Use normalized dates in difference calculations.
1738

1839
# [0.0.5 - 2 Jun 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.5)
1940

2041
- Fixed
21-
issue [#48 - WeekView header date is different from the calendar view](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/48)
42+
Issue [#48 - WeekView header date is different from the calendar view](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/48)
2243
- Added
23-
feature [#46 - Change beginning of week in MonthView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/46)
44+
Feature [#46 - Change beginning of week in MonthView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/46)
2445
- Fixed
25-
issue [#42 - WeekDayTile causes RenderFlex-Overflow](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/42)
46+
Issue [#42 - WeekDayTile causes RenderFlex-Overflow](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/42)
2647
- Fixed
27-
issue [#65 - Adding onCellTap callback breaks whole calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/65)
48+
Issue [#65 - Adding onCellTap callback breaks whole calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/65)
2849
- Fixed
29-
issue [#62 - Missing redraw events](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/62)
50+
Issue [#62 - Missing redraw events](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/62)
3051
- Fixed
31-
issue [#16 - Scroll to index/liveTime](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/16)
52+
Issue [#16 - Scroll to index/liveTime](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/16)
3253
- Show live time indicator line above event tiles.
3354
PR [#67](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/67)
3455

3556
# [0.0.4 - 2 Mar 2022](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.4)
3657

3758
- Fixed
38-
issue [#39 - Detect a long press on the calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/39)
59+
Issue [#39 - Detect a long press on the calendar](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/39)
3960
- Fixed
40-
issue [#38 - Modifying CalendarEventData](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/38)
61+
Issue [#38 - Modifying CalendarEventData](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/38)
4162
- Fixed
42-
issue [#27 - EventController remove event don't work](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/27)
63+
Issue [#27 - EventController remove event don't work](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/27)
4364
- Fixed
44-
issue [#13 - Give the option to show weekdays in a WeekView.](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/13)
65+
Issue [#13 - Give the option to show weekdays in a WeekView.](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/13)
4566

4667
# [0.0.3 - 12 Oct 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.3)
4768

4869
- Added support for multiple day events
4970

5071
# [0.0.2 - 3 Sep 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.2)
5172

52-
- Update `README.md` file.
53-
- Add license information in package files.
54-
- Update project description in `pubspec.yaml`
55-
- Update documentation.
56-
- Add `CalendarControllerProvider`.
57-
- Add `onEventTap` callback in `WeekView` and `DayView`.
58-
- Add `onCellTap` callback in `MonthView`.
73+
- Updated `README.md` file.
74+
- Added license information in package files.
75+
- Updated project description in `pubspec.yaml`
76+
- Updated documentation.
77+
- Added `CalendarControllerProvider`.
78+
- Added `onEventTap` callback in `WeekView` and `DayView`.
79+
- Added `onCellTap` callback in `MonthView`.
5980
- Make `controller` optional parameter in all views where `CalendarControllerProvider` is provided.
6081

6182
# [0.0.1 - 26 Aug 2021](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/0.0.1)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ Above code will create `WeekView` with only five days, from monday to friday.
290290
<td align="center"><a href="https://github.com/sanket-simform"><img src="https://avatars.githubusercontent.com/u/65167856?v=4" width="100px;" alt=""/><br /><sub><b>Sanket Kachhela</b></sub></a></td>
291291
<td align="center"><a href="https://github.com/ParthBaraiya"><img src="https://avatars.githubusercontent.com/u/36261739?v=4" width="100px;" alt=""/><br /><sub><b>Parth Baraiya</b></sub></a></td>
292292
<td align="center"><a href="https://github.com/ujas-m-simformsolutions"><img src="https://avatars.githubusercontent.com/u/76939001?v=4" width="100px;" alt=""/><br /><sub><b>Ujas Majithiya</b></sub></a></td>
293-
<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>
293+
<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>
294+
<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>
295+
<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>
294296
</tr>
295297
</table>
296298
<br/>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
android:theme="@style/LaunchTheme"
1010
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1111
android:hardwareAccelerated="true"
12+
android:exported="true"
1213
android:windowSoftInputMode="adjustResize">
1314
<!-- Specifies an Android theme to apply to this Activity as soon as
1415
the Android process has started. This theme is visible to the user

example/ios/Podfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '11.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
end
41+
end

example/macos/Podfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
platform :osx, '10.11'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
use_modular_headers!
32+
33+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34+
end
35+
36+
post_install do |installer|
37+
installer.pods_project.targets.each do |target|
38+
flutter_additional_macos_build_settings(target)
39+
end
40+
end

lib/calendar_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export './src/event_controller.dart';
1515
export './src/extensions.dart';
1616
export './src/modals.dart';
1717
export './src/month_view/month_view.dart';
18+
export './src/style/header_style.dart';
1819
export './src/typedefs.dart';
1920
export './src/week_view/week_view.dart';

lib/src/components/_internal_components.dart

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ class EventGenerator<T extends Object?> extends StatelessWidget {
237237
events[index].top,
238238
width - events[index].right - events[index].left,
239239
height - events[index].bottom - events[index].top),
240-
events[index].startDuration ?? DateTime.now(),
241-
events[index].endDuration ?? DateTime.now(),
240+
events[index].startDuration,
241+
events[index].endDuration,
242242
);
243243
}),
244244
),
@@ -295,6 +295,15 @@ class PressDetector extends StatelessWidget {
295295
/// Called when user long press on calendar.
296296
final DatePressCallback? onDateLongPress;
297297

298+
/// Called when user taps on day view page.
299+
///
300+
/// This callback will have a date parameter which
301+
/// will provide the time span on which user has tapped.
302+
///
303+
/// Ex, User Taps on Date page with date 11/01/2022 and time span is 1PM to 2PM.
304+
/// then DateTime object will be DateTime(2022,01,11,1,0)
305+
final DateTapCallback? onDateTap;
306+
298307
/// Defines size of the slots that provides long press callback on area
299308
/// where events are not available.
300309
final MinuteSlotSize minuteSlotSize;
@@ -307,6 +316,7 @@ class PressDetector extends StatelessWidget {
307316
required this.heightPerMinute,
308317
required this.date,
309318
required this.onDateLongPress,
319+
required this.onDateTap,
310320
required this.minuteSlotSize,
311321
}) : super(key: key);
312322

@@ -328,6 +338,15 @@ class PressDetector extends StatelessWidget {
328338
bottom: height - (heightPerSlot * (i + 1)),
329339
child: GestureDetector(
330340
behavior: HitTestBehavior.translucent,
341+
onTap: () => onDateTap?.call(
342+
DateTime(
343+
date.year,
344+
date.month,
345+
date.day,
346+
0,
347+
minuteSlotSize.minutes * i,
348+
),
349+
),
331350
onLongPress: () => onDateLongPress?.call(
332351
DateTime(
333352
date.year,

lib/src/components/common_components.dart

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
66
import 'package:flutter/material.dart';
77

88
import '../constants.dart';
9+
import '../style/header_style.dart';
910
import '../typedefs.dart';
1011

1112
class CalendarPageHeader extends StatelessWidget {
@@ -29,14 +30,18 @@ class CalendarPageHeader extends StatelessWidget {
2930
/// Provides string to display as title.
3031
final StringProvider dateStringBuilder;
3132

32-
/// backgeound color of header.
33+
// TODO: Need to remove after next release
34+
/// background color of header.
35+
@Deprecated("Use Header Style to provide background")
3336
final Color backgroundColor;
3437

38+
// TODO: Need to remove after next release
3539
/// Color of icons at both sides of header.
40+
@Deprecated("Use Header Style to provide icon color")
3641
final Color iconColor;
3742

38-
/// Style of title.
39-
final TextStyle? textStyle;
43+
/// Style for Calendar's header
44+
final HeaderStyle headerStyle;
4045

4146
/// Common header for month and day view In this header user can define format
4247
/// in which date will be displayed by providing [dateStringBuilder] function.
@@ -48,59 +53,65 @@ class CalendarPageHeader extends StatelessWidget {
4853
this.onTitleTapped,
4954
this.onPreviousDay,
5055
this.secondaryDate,
51-
this.backgroundColor = Constants.headerBackground,
52-
this.iconColor = Constants.black,
53-
this.textStyle,
56+
@Deprecated("Use Header Style to provide background")
57+
this.backgroundColor = Constants.headerBackground,
58+
@Deprecated("Use Header Style to provide icon color")
59+
this.iconColor = Constants.black,
60+
this.headerStyle = const HeaderStyle(),
5461
}) : super(key: key);
5562

5663
@override
5764
Widget build(BuildContext context) {
5865
return Container(
59-
decoration: BoxDecoration(
60-
color: backgroundColor,
61-
),
66+
margin: headerStyle.headerMargin,
67+
padding: headerStyle.headerPadding,
68+
decoration:
69+
// ignore_for_file: deprecated_member_use_from_same_package
70+
headerStyle.decoration ?? BoxDecoration(color: backgroundColor),
6271
clipBehavior: Clip.antiAlias,
6372
child: Row(
6473
mainAxisAlignment: MainAxisAlignment.spaceBetween,
6574
children: [
66-
IconButton(
67-
onPressed: onPreviousDay,
68-
splashColor: Colors.transparent,
69-
focusColor: Colors.transparent,
70-
hoverColor: Colors.transparent,
71-
highlightColor: Colors.transparent,
72-
padding:
73-
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
74-
icon: Icon(
75-
Icons.chevron_left,
76-
size: 30,
77-
color: iconColor,
75+
if (headerStyle.leftIconVisible)
76+
IconButton(
77+
onPressed: onPreviousDay,
78+
splashColor: Colors.transparent,
79+
focusColor: Colors.transparent,
80+
hoverColor: Colors.transparent,
81+
highlightColor: Colors.transparent,
82+
padding: headerStyle.leftIconPadding,
83+
icon: headerStyle.leftIcon ??
84+
Icon(
85+
Icons.chevron_left,
86+
size: 30,
87+
color: iconColor,
88+
),
7889
),
79-
),
8090
Expanded(
8191
child: InkWell(
8292
onTap: onTitleTapped,
8393
child: Text(
8494
dateStringBuilder(date, secondaryDate: secondaryDate),
85-
textAlign: TextAlign.center,
86-
style: textStyle,
95+
textAlign: headerStyle.titleAlign,
96+
style: headerStyle.headerTextStyle,
8797
),
8898
),
8999
),
90-
IconButton(
91-
onPressed: onNextDay,
92-
splashColor: Colors.transparent,
93-
focusColor: Colors.transparent,
94-
hoverColor: Colors.transparent,
95-
highlightColor: Colors.transparent,
96-
padding:
97-
const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
98-
icon: Icon(
99-
Icons.chevron_right,
100-
size: 30,
101-
color: iconColor,
100+
if (headerStyle.rightIconVisible)
101+
IconButton(
102+
onPressed: onNextDay,
103+
splashColor: Colors.transparent,
104+
focusColor: Colors.transparent,
105+
hoverColor: Colors.transparent,
106+
highlightColor: Colors.transparent,
107+
padding: headerStyle.rightIconPadding,
108+
icon: headerStyle.rightIcon ??
109+
Icon(
110+
Icons.chevron_right,
111+
size: 30,
112+
color: iconColor,
113+
),
102114
),
103-
),
104115
],
105116
),
106117
);

0 commit comments

Comments
 (0)