Skip to content

Commit

Permalink
✨ Migrated package to flutter 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DhavalRKansara committed Aug 4, 2023
1 parent 2e37447 commit 1bd4fbf
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 122 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Issue [#219 - There is an issue with the daily view layout display](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/219)
- Fixed
Issue [#205 - SafeArea can't be deactivated on MonthView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/205)
- Migrate to Flutter 3.

# [1.0.3 - 3 Apr 2023](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.3)

Expand Down
3 changes: 1 addition & 2 deletions example/lib/pages/create_event_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import '../widgets/add_event_widget.dart';
class CreateEventPage extends StatefulWidget {
final bool withDuration;

const CreateEventPage({Key? key, this.withDuration = false})
: super(key: key);
const CreateEventPage({super.key, this.withDuration = false});

@override
_CreateEventPageState createState() => _CreateEventPageState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/day_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../widgets/day_view_widget.dart';
import 'create_event_page.dart';

class DayViewPageDemo extends StatefulWidget {
const DayViewPageDemo({Key? key}) : super(key: key);
const DayViewPageDemo({super.key});

@override
_DayViewPageDemoState createState() => _DayViewPageDemoState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/event_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../extension.dart';
class DetailsPage extends StatelessWidget {
final CalendarEventData event;

const DetailsPage({Key? key, required this.event}) : super(key: key);
const DetailsPage({super.key, required this.event});
@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/month_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'create_event_page.dart';

class MonthViewPageDemo extends StatefulWidget {
const MonthViewPageDemo({
Key? key,
}) : super(key: key);
super.key,
});

@override
_MonthViewPageDemoState createState() => _MonthViewPageDemoState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../widgets/week_view_widget.dart';
import 'create_event_page.dart';

class WeekViewDemo extends StatefulWidget {
const WeekViewDemo({Key? key}) : super(key: key);
const WeekViewDemo({super.key});

@override
_WeekViewDemoState createState() => _WeekViewDemoState();
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/add_event_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class AddEventWidget extends StatefulWidget {
final void Function(CalendarEventData<Event>)? onEventAdd;

const AddEventWidget({
Key? key,
super.key,
this.onEventAdd,
}) : super(key: key);
});

@override
_AddEventWidgetState createState() => _AddEventWidgetState();
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/calendar_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class CalendarConfig extends StatelessWidget {
final CalendarView currentView;

const CalendarConfig({
Key? key,
super.key,
required this.onViewChange,
this.currentView = CalendarView.month,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
3 changes: 1 addition & 2 deletions example/lib/widgets/calendar_views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import 'week_view_widget.dart';
class CalendarViews extends StatelessWidget {
final CalendarView view;

const CalendarViews({Key? key, this.view = CalendarView.month})
: super(key: key);
const CalendarViews({super.key, this.view = CalendarView.month});

final _breakPoint = 490.0;

Expand Down
3 changes: 1 addition & 2 deletions example/lib/widgets/custom_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ class CustomButton extends StatelessWidget {
final String title;
final VoidCallback? onTap;

const CustomButton({Key? key, required this.title, this.onTap})
: super(key: key);
const CustomButton({super.key, required this.title, this.onTap});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/day_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class DayViewWidget extends StatelessWidget {
final double? width;

const DayViewWidget({
Key? key,
super.key,
this.state,
this.width,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/month_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class MonthViewWidget extends StatelessWidget {
final double? width;

const MonthViewWidget({
Key? key,
super.key,
this.state,
this.width,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/widgets/responsive_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class ResponsiveWidget extends StatelessWidget {
final Widget mobileWidget;

const ResponsiveWidget({
Key? key,
super.key,
this.width,
this.breakPoint = BreakPoints.web,
required this.webWidget,
required this.mobileWidget,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/week_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class WeekViewWidget extends StatelessWidget {
final GlobalKey<WeekViewState>? state;
final double? width;

const WeekViewWidget({Key? key, this.state, this.width}) : super(key: key);
const WeekViewWidget({super.key, this.state, this.width});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: '>=3.0.0-0 <4.0.0'

dependencies:
flutter:
Expand Down
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
17 changes: 8 additions & 9 deletions lib/src/components/_internal_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ 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})
: super(key: key);
required this.heightPerMinute});

@override
_LiveTimeIndicatorState createState() => _LiveTimeIndicatorState();
Expand Down Expand Up @@ -121,14 +120,14 @@ class TimeLine extends StatelessWidget {

/// 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,
required this.timeLineOffset,
required this.timeLineBuilder,
this.showHalfHours = false,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -220,7 +219,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 @@ -230,7 +229,7 @@ class EventGenerator<T extends Object?> extends StatelessWidget {
required this.date,
required this.onTileTap,
required this.scrollNotifier,
}) : 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 @@ -339,15 +338,15 @@ 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,
required this.date,
required this.onDateLongPress,
required this.onDateTap,
required this.minuteSlotSize,
}) : 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 @@ -46,7 +46,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 @@ -58,7 +58,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
41 changes: 15 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,28 +115,20 @@ 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}) =>
"${date.day} - ${date.month} - ${date.year}";
}
Expand All @@ -156,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 @@ -190,15 +179,15 @@ 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,
this.itemView,
this.titleStyle,
this.onEventTap,
required this.date,
}) : super(key: key);
});

/// Constraints for view
final BoxConstraints boxConstraints;
Expand Down
Loading

0 comments on commit 1bd4fbf

Please sign in to comment.