Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Migrated package to flutter 3.0 #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# [1.3.0] (UnReleased)
- Migrate to Flutter 3.

# [1.2.0 - 10 May 2024](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.2.0)

- Fixed issue when adding full-day events to WeekView, event is not display at correct date. [#259](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/259)
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
intl:
flutter_colorpicker: ^0.6.0
flutter_colorpicker: ^1.1.0
calendar_view:
path: ../

Expand Down
12 changes: 1 addition & 11 deletions example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
6 changes: 3 additions & 3 deletions lib/src/calendar_controller_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class CalendarControllerProvider<T extends Object?> extends InheritedWidget {
/// Use this widget to provide same controller object to all calendar
/// view widgets and synchronize events between them.
const CalendarControllerProvider({
Key? key,
super.key,
required this.controller,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});

static CalendarControllerProvider<T> of<T extends Object?>(
BuildContext context) {
Expand Down
16 changes: 8 additions & 8 deletions lib/src/components/_internal_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class LiveTimeIndicator extends StatefulWidget {

/// Widget to display tile line according to current time.
const LiveTimeIndicator({
Key? key,
super.key,
required this.width,
required this.height,
required this.timeLineWidth,
required this.liveTimeIndicatorSettings,
required this.heightPerMinute,
required this.startHour,
this.endHour = Constants.hoursADay,
}) : super(key: key);
});

@override
_LiveTimeIndicatorState createState() => _LiveTimeIndicatorState();
Expand Down Expand Up @@ -169,7 +169,7 @@ class TimeLine extends StatefulWidget {

/// Time line to display time at left side of day or week view.
const TimeLine({
Key? key,
super.key,
required this.timeLineWidth,
required this.hourHeight,
required this.height,
Expand All @@ -180,7 +180,7 @@ class TimeLine extends StatefulWidget {
this.showQuarterHours = false,
required this.liveTimeIndicatorSettings,
this.endHour = Constants.hoursADay,
}) : super(key: key);
});

@override
State<TimeLine> createState() => _TimeLineState();
Expand Down Expand Up @@ -357,7 +357,7 @@ class EventGenerator<T extends Object?> extends StatelessWidget {

/// A widget that display event tiles in day/week view.
const EventGenerator({
Key? key,
super.key,
required this.height,
required this.width,
required this.events,
Expand All @@ -371,7 +371,7 @@ class EventGenerator<T extends Object?> extends StatelessWidget {
required this.scrollNotifier,
required this.onTileDoubleTap,
this.endHour = Constants.hoursADay,
}) : super(key: key);
});

/// Arrange events and returns list of [Widget] that displays event
/// tile on display area. This method uses [eventArranger] to get position
Expand Down Expand Up @@ -486,7 +486,7 @@ class PressDetector extends StatelessWidget {

/// A widget that display event tiles in day/week view.
const PressDetector({
Key? key,
super.key,
required this.height,
required this.width,
required this.heightPerMinute,
Expand All @@ -495,7 +495,7 @@ class PressDetector extends StatelessWidget {
required this.onDateTap,
required this.minuteSlotSize,
required this.startHour,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/common_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CalendarPageHeader extends StatelessWidget {
/// Common header for month and day view In this header user can define format
/// in which date will be displayed by providing [dateStringBuilder] function.
const CalendarPageHeader({
Key? key,
super.key,
required this.date,
required this.dateStringBuilder,
this.onNextDay,
Expand All @@ -62,7 +62,7 @@ class CalendarPageHeader extends StatelessWidget {
@Deprecated("Use Header Style to provide icon color")
this.iconColor = Constants.black,
this.headerStyle = const HeaderStyle(),
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
40 changes: 14 additions & 26 deletions lib/src/components/day_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
// Use of this source code is governed by a MIT-style license
// that can be found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../calendar_event_data.dart';
import '../constants.dart';
import '../extensions.dart';
import '../style/header_style.dart';
import '../typedefs.dart';
import 'common_components.dart';

Expand Down Expand Up @@ -45,7 +42,7 @@ class RoundedEventTile extends StatelessWidget {

/// This is default tile to display in day view.
const RoundedEventTile({
Key? key,
super.key,
required this.title,
this.padding = EdgeInsets.zero,
this.margin = EdgeInsets.zero,
Expand All @@ -55,7 +52,7 @@ class RoundedEventTile extends StatelessWidget {
this.backgroundColor = Colors.blue,
this.titleStyle,
this.descriptionStyle,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -118,27 +115,18 @@ class RoundedEventTile extends StatelessWidget {
class DayPageHeader extends CalendarPageHeader {
/// A header widget to display on day view.
const DayPageHeader({
Key? key,
VoidCallback? onNextDay,
AsyncCallback? onTitleTapped,
VoidCallback? onPreviousDay,
Color iconColor = Constants.black,
Color backgroundColor = Constants.headerBackground,
super.key,
super.onNextDay,
super.onTitleTapped,
super.onPreviousDay,
super.iconColor,
super.backgroundColor,
StringProvider? dateStringBuilder,
required DateTime date,
HeaderStyle headerStyle = const HeaderStyle(),
required super.date,
super.headerStyle,
}) : super(
key: key,
date: date,
// ignore_for_file: deprecated_member_use_from_same_package
backgroundColor: backgroundColor,
iconColor: iconColor,
onNextDay: onNextDay,
onPreviousDay: onPreviousDay,
onTitleTapped: onTitleTapped,
dateStringBuilder:
dateStringBuilder ?? DayPageHeader._dayStringBuilder,
headerStyle: headerStyle,
);

static String _dayStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
Expand All @@ -157,11 +145,11 @@ class DefaultTimeLineMark extends StatelessWidget {

/// Time marker for timeline used in week and day view.
const DefaultTimeLineMark({
Key? key,
super.key,
required this.date,
this.markingStyle,
this.timeStringBuilder,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -191,7 +179,7 @@ class DefaultTimeLineMark extends StatelessWidget {
/// This class is defined default view of full day event
class FullDayEventView<T> extends StatelessWidget {
const FullDayEventView({
Key? key,
super.key,
this.boxConstraints = const BoxConstraints(maxHeight: 100),
required this.events,
this.padding,
Expand All @@ -201,7 +189,7 @@ class FullDayEventView<T> extends StatelessWidget {
required this.date,
this.onEventDoubleTap,
this.onEventLongPress,
}) : super(key: key);
});

/// Constraints for view
final BoxConstraints boxConstraints;
Expand Down
33 changes: 12 additions & 21 deletions lib/src/components/month_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// Use of this source code is governed by a MIT-style license
// that can be found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../calendar_event_data.dart';
import '../constants.dart';
import '../extensions.dart';
import '../style/header_style.dart';
import '../typedefs.dart';
import 'common_components.dart';

Expand All @@ -34,14 +32,14 @@ class CircularCell extends StatelessWidget {
/// This class will defines how cell will be displayed.
/// To get proper view user [CircularCell] with 1 [MonthView.cellAspectRatio].
const CircularCell({
Key? key,
super.key,
required this.date,
this.events = const [],
this.shouldHighlight = false,
this.backgroundColor = Colors.blue,
this.highlightedTitleColor = Constants.white,
this.titleColor = Constants.black,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -110,7 +108,7 @@ class FilledCell<T extends Object?> extends StatelessWidget {
/// This class will defines how cell will be displayed.
/// This widget will display all the events as tile below date title.
const FilledCell({
Key? key,
super.key,
required this.date,
required this.events,
this.isInMonth = false,
Expand All @@ -126,7 +124,7 @@ class FilledCell<T extends Object?> extends StatelessWidget {
this.highlightedTitleColor = Constants.white,
this.dateStringBuilder,
this.onTileDoubleTap,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -213,27 +211,20 @@ class FilledCell<T extends Object?> extends StatelessWidget {
class MonthPageHeader extends CalendarPageHeader {
/// A header widget to display on month view.
const MonthPageHeader({
Key? key,
super.key,
VoidCallback? onNextMonth,
AsyncCallback? onTitleTapped,
super.onTitleTapped,
VoidCallback? onPreviousMonth,
Color iconColor = Constants.black,
Color backgroundColor = Constants.headerBackground,
super.iconColor,
super.backgroundColor,
StringProvider? dateStringBuilder,
required DateTime date,
HeaderStyle headerStyle = const HeaderStyle(),
required super.date,
super.headerStyle,
}) : super(
key: key,
date: date,
onNextDay: onNextMonth,
onPreviousDay: onPreviousMonth,
onTitleTapped: onTitleTapped,
// ignore_for_file: deprecated_member_use_from_same_package
backgroundColor: backgroundColor,
iconColor: iconColor,
dateStringBuilder:
dateStringBuilder ?? MonthPageHeader._monthStringBuilder,
headerStyle: headerStyle,
);

static String _monthStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
Expand All @@ -258,13 +249,13 @@ class WeekDayTile extends StatelessWidget {

/// Title for week day in month view.
const WeekDayTile({
Key? key,
super.key,
required this.dayIndex,
this.backgroundColor = Constants.white,
this.displayBorder = true,
this.textStyle,
this.weekDayStringBuilder,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
3 changes: 1 addition & 2 deletions lib/src/components/safe_area_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import 'package:flutter/material.dart';
class SafeAreaWrapper extends SafeArea {
SafeAreaWrapper({
SafeAreaOption option = const SafeAreaOption(),
required Widget child,
required super.child,
}) : super(
left: option.left,
top: option.top,
right: option.right,
bottom: option.bottom,
minimum: option.minimum,
maintainBottomViewPadding: option.maintainBottomViewPadding,
child: child,
);
}

Expand Down
Loading
Loading