SimformSolutionsPvtLtd / flutter_calendar_view

A Flutter package allows you to easily implement all calendar UI and calendar event functionality. 👌🔝🎉
https://pub.dev/packages/calendar_view
MIT License
435 stars 259 forks source link

Type is not a subtype of type #380

Closed Geparder closed 2 months ago

Geparder commented 5 months ago

Bug in Flutter 3.22.2:

The following _TypeError was thrown building InternalWeekViewPage<...>-[<'60.02024-06-17 00:00:00.000'>](state: _InternalWeekViewPageState<Object?>#8c681): type '(List<CalendarEventData<...>>, DateTime) => void' is not a subtype of type '((List<CalendarEventData<Object?>>, DateTime) => void)?'

on onEventTap

need:

  @override
  State<InternalWeekViewPage> createState() => _InternalWeekViewPageState();

to

  @override
  State<InternalWeekViewPage> createState() => _InternalWeekViewPageState<T>();

and all same files

Geparder commented 5 months ago

Code correction. Unfortunately, there are no access rights to make a pull request. Please make corrections. Thank you!

---
 lib/src/day_view/_internal_day_view_page.dart   | 2 +-
 lib/src/week_view/_internal_week_view_page.dart | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/src/day_view/_internal_day_view_page.dart b/lib/src/day_view/_internal_day_view_page.dart
index d46be38..d608629 100644
--- a/lib/src/day_view/_internal_day_view_page.dart
+++ b/lib/src/day_view/_internal_day_view_page.dart
@@ -176,7 +176,7 @@ class InternalDayViewPage<T extends Object?> extends StatefulWidget {
   }) : super(key: key);

   @override
-  _InternalDayViewPageState<T> createState() => _InternalDayViewPageState();
+  _InternalDayViewPageState<T> createState() => _InternalDayViewPageState<T>();
 }

 class _InternalDayViewPageState<T extends Object?>
diff --git a/lib/src/week_view/_internal_week_view_page.dart b/lib/src/week_view/_internal_week_view_page.dart
index 2603e89..ff73a61 100644
--- a/lib/src/week_view/_internal_week_view_page.dart
+++ b/lib/src/week_view/_internal_week_view_page.dart
@@ -211,7 +211,7 @@ class InternalWeekViewPage<T extends Object?> extends StatefulWidget {
   }) : super(key: key);

   @override
-  _InternalWeekViewPageState<T> createState() => _InternalWeekViewPageState();
+  _InternalWeekViewPageState<T> createState() => _InternalWeekViewPageState<T>();
 }

 class _InternalWeekViewPageState<T extends Object?>
-- 

Снимок экрана 2024-06-17 в 14 09 25 Снимок экрана 2024-06-17 в 14 09 29

dkobia commented 4 months ago

@Geparder It looks like this has been resolved by e3c127b9a5f92208c0ef3cbe9ba2664d64261c0d

Geparder commented 4 months ago

Not certainly in that way. The error keeps appearing. You just need to initialize the object instance as Generic.

Need:

_InternalWeekViewPageState<T> createState() => _InternalWeekViewPageState<T>();

ProfessorX737 commented 4 months ago

Yes please fix this. Quite crucial part of the package. just need the <T>