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

Calendar Crash #515

Closed
M0in4 opened this issue Jan 13, 2022 · 9 comments
Closed

Calendar Crash #515

M0in4 opened this issue Jan 13, 2022 · 9 comments

Comments

@M0in4
Copy link

M0in4 commented Jan 13, 2022

Its crashing when I change the view of calendar from 'Month' to 'Program'

Line 912 got : return SfCalendar() and its the same as example
`======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1532 pos 12: 'correctedOffset.isFinite': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was:
SfCalendar SfCalendar:file:///Users/Developer_Flutter/Apps/lib/pages/admin/getting_started.dart:912:12
When the exception was thrown, this was the stack:
#2 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1532:12)
#3 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#4 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#5 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#6 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#7 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#8 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#9 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#10 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#11 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#12 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#13 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#14 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#15 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#16 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#17 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#18 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#19 RenderStack.layoutPositionedChild (package:flutter/src/rendering/stack.dart:497:11)
#20 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:610:30)
#21 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#22 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#23 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#24 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#25 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#26 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:277:14)
#27 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#28 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#29 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#30 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#31 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#32 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:319:14)
#33 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#34 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#35 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#36 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56:11)
#37 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:896:45)
#38 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:931:32)
#39 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#40 RenderSliverRefreshBody.performLayout (package:pull_to_refresh/src/internals/slivers.dart:542:14)
#41 RenderObject.layout (package:flutter/src/rendering/object.dart:1852:7)
#42 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#43 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580:12)
#44 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489:20)
#45 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1707:7)
#46 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:879:18)
#47 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:497:19)
#48 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#49 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#50 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#51 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#52 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#56 _invoke (dart:ui/hooks.dart:150:10)
#57 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#58 _drawFrame (dart:ui/hooks.dart:114:31)
(elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: RenderViewport#57e0d NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, h=714.0)
... size: Size(414.0, 714.0)
... axisDirection: down
... crossAxisDirection: right
... offset: ScrollPositionWithSingleContext#45596(offset: Infinity, range: -Infinity..Infinity, viewport: 714.0, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics -> RangeMaintainingScrollPhysics, BallisticScrollActivity#a5e6d(AnimationController#e111e(▶ 95.000; for BallisticScrollActivity)), ScrollDirection.idle)
... anchor: 0.0
RenderObject: RenderViewport#57e0d NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: (can use size)
constraints: BoxConstraints(w=414.0, h=714.0)
size: Size(414.0, 714.0)
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#45596(offset: Infinity, range: -Infinity..Infinity, viewport: 714.0, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics -> RangeMaintainingScrollPhysics, BallisticScrollActivity#a5e6d(AnimationController#e111e(▶ 95.000; for BallisticScrollActivity)), ScrollDirection.idle)
anchor: 0.0
... child -1: RenderSliverList#9dcd8 relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: paintOffset=Offset(0.0, 0.0) (can use size)
... constraints: SliverConstraints(AxisDirection.down, GrowthDirection.reverse, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 414.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 714.0, remainingCacheExtent: 155.0, cacheOrigin: 0.0)
... geometry: SliverGeometry(scrollExtent: Infinity, hidden, maxPaintExtent: Infinity, hasVisualOverflow: true, cacheExtent: 155.0)
... scrollExtent: Infinity
... hidden
... maxPaintExtent: Infinity
... hasVisualOverflow: true
... cacheExtent: 155.0
... currently live children: 0 to 1
... child with index 0: RenderIndexedSemantics#ab8bc relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: index=0; layoutOffset=0.0 (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 35.0)
... index: 0
... child: RenderRepaintBoundary#aa826 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 35.0)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderConstrainedBox#cd6c0 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 35.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=35.0)
... child with index 1: RenderIndexedSemantics#93273 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: index=1; layoutOffset=35.0 (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 190.0)
... index: 1
... child: RenderRepaintBoundary#4d557 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 190.0)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderConstrainedBox#23507 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 190.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=190.0)
... center child: RenderSliverList#1f37d relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: paintOffset=Offset(0.0, 0.0) (can use size)
... constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 95.0, remainingPaintExtent: 714.0, crossAxisExtent: 414.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 714.0, remainingCacheExtent: 1059.0, cacheOrigin: -95.0)
... geometry: SliverGeometry(scrollExtent: Infinity, paintExtent: 714.0, maxPaintExtent: Infinity, hasVisualOverflow: true, cacheExtent: 1059.0)
... scrollExtent: Infinity
... paintExtent: 714.0
... maxPaintExtent: Infinity
... hasVisualOverflow: true
... cacheExtent: 1059.0
... currently live children: 0 to 2
... child with index 0: RenderIndexedSemantics#e153f relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: index=0; layoutOffset=0.0 (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 155.0)
... index: 0
... child: RenderRepaintBoundary#9a5be relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 155.0)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderConstrainedBox#4efa9 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 155.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=155.0)
... child with index 1: RenderIndexedSemantics#c8d54 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: index=1; layoutOffset=155.0 (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 440.0)
... index: 1
... child: RenderRepaintBoundary#589ea relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 440.0)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderConstrainedBox#f68f7 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 440.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=440.0)
... child with index 2: RenderIndexedSemantics#a9cbf relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: index=2; layoutOffset=595.0 (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 1650.0)
... index: 2
... child: RenderRepaintBoundary#fe504 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 1650.0)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderConstrainedBox#f42d6 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: (can use size)
... constraints: BoxConstraints(w=414.0, 0.0<=h<=Infinity)
... size: Size(414.0, 1650.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=1650.0)`

@Indumathi1195R
Copy link

Hi Team,

Thank you for contacting Syncfusion support.

Based on the shared information, we have checked the mentioned issue “Exception occurred while switching view from month view of calendar”. We have checked with the allowedViews property and view property from the CalendarController and there is no exception, it was working fine as expected from our end. Please find the sample from the following link.

Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/getting-event-details-calendar-fluter-master1611399171.zip

Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us with following details,

  1. Exception reproducing video.
  2. Code snippet
  3. Issue reproducing scenario

It will be helpful for us to check on it and provide you solution at the earliest.

Regards,
Indumathi R

@M0in4
Copy link
Author

M0in4 commented Jan 20, 2022

Its still crashing in other part.

The following assertion was thrown while dispatching notifications for ValueNotifier<List>:
setState() or markNeedsBuild() called during build.

This _PickerHeaderView widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
The widget on which setState() or markNeedsBuild() was called was: _PickerHeaderView
dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#d5a16]]
state: _PickerHeaderViewState#16f5e
The widget which was currently being built when the offending call was made was: _AnimatedOpacityWidget
state: _AnimatedOpacityWidgetState#830b2

@Indumathi1195R

@Indumathi1195R
Copy link

Hi Team,

Thank you for the update.

Based on the exception, we suspect you are calling the set state before the widget building is completed. Kindly use the set state after the widget building is completed. If possible, can you please share the below details with us? It would be helpful for us to analyze and provide you with a solution at the earliest.

• Issue reproducing scenario
• Code snippet
• Issue reproducing video

Regards,
Indumathi R

@M0in4
Copy link
Author

M0in4 commented Jan 24, 2022

Its crashing when I am changing the view of calendar and precisely here:

  void onCalendarTapped(CalendarTapDetails calendarTapDetails) async {

    if (calendarTapDetails.targetElement != CalendarElement.calendarCell &&
        calendarTapDetails.targetElement != CalendarElement.appointment) {
      return;
    }

    setState(() {
      _selectedAppointment = null;
      if (_calendarController.view == CalendarView.month) {
        _calendarController.view = CalendarView.day;
      } else {
        if (calendarTapDetails.appointments != null &&
            calendarTapDetails.targetElement == CalendarElement.appointment) {
          final Meeting meetingDetails = calendarTapDetails.appointments![0];
          _appointmentDate = meetingDetails.appointment.AppointmentDateTime;
          _selectedAppointment = meetingDetails;
        }
      }
    });
}

Failed to send request: {"jsonrpc":"2.0","id":"30","method":"getObject","params":{"isolateId":"isolates/610795589633931","objectId":"libraries/@899171358"}}

Update:
I've understand where is the problem.
Actually I am adding the calendar inside a Column because I have to put a title on calendar like an header but its crashing at change view.
How can I fix it?

body: SmartRefresher( enablePullDown: true, enablePullUp: false, header: WaterDropHeader( waterDropColor: Color(0xFF2697FF), idleIcon: Icon(Icons.autorenew, size: 15, color: Colors.white), ), controller: _refreshController, onRefresh: _onRefresh, child: SingleChildScrollView( child: Column(children: [ HeaderNoProfile(title: "Title"), SizedBox(height: defaultAdminPadding), _calendarController.view == CalendarView.month ? Scrollbar( isAlwaysShown: true, controller: _controller, child: ListView( controller: _controller, children: <Widget>[ Container( color: Colors.white, height: 600, child: calendar, ) ], )) : Container(color: Colors.white, child: calendar), ]), ), ),

@Indumathi1195R
Copy link

Hi,

Based on the shared code snippet, we have checked We have checked “Calendar crashes while switching the calendar views". There is no need to setState() code while using CalendarController. Kindly remove the setState() code from onTap callback.

Code snippet:

void onCalendarTapped(CalendarTapDetails calendarTapDetails) async {

    if (calendarTapDetails.targetElement != CalendarElement.calendarCell &&
        calendarTapDetails.targetElement != CalendarElement.appointment) {
      return;
    }
      _selectedAppointment = null;
      if (_calendarController.view == CalendarView.month) {
        _calendarController.view = CalendarView.day;
      } else {
        if (calendarTapDetails.appointments != null &&
            calendarTapDetails.targetElement == CalendarElement.appointment) {
          final Meeting meetingDetails = calendarTapDetails.appointments![0];
          _appointmentDate = meetingDetails.appointment.AppointmentDateTime;
          _selectedAppointment = meetingDetails;
        }
      }

If possible can you please share the code snippet with video for reproducing the issue from our end. It would be helpful for us to analyze and provide you a solution at the earliest.

Regards,
Indumathi R

@M0in4
Copy link
Author

M0in4 commented Jan 25, 2022

Yes.
I've already tried without setState but the main problem is that I got that type of code (My calendar is inside a Column). If I delete column and I put only Calendar, it won't crash.

    return Scaffold(
      backgroundColor: bgColor,
      body: SmartRefresher(
        enablePullDown: true,
        enablePullUp: false,
        header: WaterDropHeader(
          waterDropColor: Color(0xFF2697FF),
          idleIcon: Icon(Icons.autorenew, size: 15, color: Colors.white),
        ),
        controller: _refreshController,
        onRefresh: _onRefresh,
        child: Column(children: [
          HeaderNoProfile(title: "Issues"),
          SizedBox(height: defaultAdminPadding),
          Expanded(
              child: _calendarController.view == CalendarView.month &&
                      //model.isWebFullView &&
                      screenHeight < 800
                  ? Scrollbar(
                      isAlwaysShown: true,
                      controller: _controller,
                      child: ListView(
                        controller: _controller,
                        children: <Widget>[
                          Container(
                            color: Colors.white,
                            height: 600,
                            child: calendar,
                          )
                        ],
                      ))
                  : Container(color: Colors.white, child: calendar)),
        ]),
      ),
    );
  }

@muthulakshmi-123
Copy link

Hi,

Thank you for contacting Syncfusion support.

Based on the provided information we have checked the mentioned issue “Calendar crashes while the calendar is inside the column", based on the provided code snippet, we have prepared the simple sample, we could not reproduce the mentioned issue from our end.

For your reference, we have attached the tested sample for the same.
https://www.syncfusion.com/downloads/support/directtrac/general/ze/calendar_details-1439332663

Could you please modify the shared sample to replicate the issue, share more details, or if possible, share the calendar code snippets used with the replication procedure and revert us back with the following details,

• Issue reproducing video (if possible)
• Replication procedure for crash

It will be helpful for us to check on it and provide you with a possible solution at the earliest.

Please let us know if you need further assistance.

Regards,
Muthulakshmi K

@M0in4
Copy link
Author

M0in4 commented Jan 28, 2022

Can we talk on Slack? Its still crashing and I can't paste here full code because it won't work, I am downloading data from API, etc

@Indumathi1195R
Copy link

Hi,

Could you please open a ticket under your account to track this issue? You can create the ticket using the link below.

Link: https://support.syncfusion.com/support/tickets

Regards,
Indumathi R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants