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

PaneItemEpander Widget crashes the app when the Pane is collapsed🐛 #670

Closed
edewindt opened this issue Jan 4, 2023 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@edewindt
Copy link

edewindt commented Jan 4, 2023

Describe the bug
PaneItemEpander Widget crashes the app when the Pane is collapsed.

To Reproduce
Steps to reproduce the behavior:

  1. Create PaneItemExpander
  2. Click on the Icon while Pane is collapsed
  3. 'This widget has been unmounted, so the State no longer has a context (and should be considered defunct). \n'
    'Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.', thrown

Expected behavior
I expected the Navigation to not crash the entire application and throw an error.

Screenshots

New-video

@edewindt edewindt changed the title 🐛 PaneItemEpander Widget crashes the app when the Pane is collapsed🐛 Jan 4, 2023
@bdlukaa
Copy link
Owner

bdlukaa commented Jan 5, 2023

It's be very helpful if you could run the app with flutter run, and post the full error here

@edewindt
Copy link
Author

edewindt commented Jan 5, 2023

flutterrun errors

@edewindt
Copy link
Author

edewindt commented Jan 5, 2023

══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
This widget has been unmounted, so the State no longer has a context (and should be considered
defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if
the State is still active.

When the exception was thrown, this was the stack:
#0 State.context. (package:flutter/src/widgets/framework.dart:947:9)
#1 State.context (package:flutter/src/widgets/framework.dart:953:6)
#2 NavigationIndicatorState.pane (package:fluent_ui/src/controls/navigation/navigation_view/indicators.dart:70:39)
#3 NavigationIndicatorState.fetch. (package:fluent_ui/src/controls/navigation/navigation_view/indicators.dart:60:28)
#4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175:15)
#5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:9)
#6 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1015:5)
#7 _invoke (dart:ui/hooks.dart:148:13)
#8 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:318:5)
#9 _drawFrame (dart:ui/hooks.dart:115:31)
════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: setState() called after dispose(): _StickyNavigationIndicatorState#0405b(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)

Another exception was thrown: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).

Another exception was thrown: setState() called after dispose(): _StickyNavigationIndicatorState#80327(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)

Another exception was thrown: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).

Another exception was thrown: setState() called after dispose(): _StickyNavigationIndicatorState#85c9b(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)

@bdlukaa bdlukaa added the bug Something isn't working label Jan 5, 2023
@bdlukaa bdlukaa closed this as completed in ef0b7ea Jan 5, 2023
@AyberkAhmet
Copy link

I have same problem but different error message. Please reopen this issue. Also I see same problem on example website(https://bdlukaa.github.io/fluent_ui/).

My code:

Widget getNavBar() {
    return fluent.NavigationView(
      //appBar: const fluent.NavigationAppBar(title: Text('NavigationView'), backgroundColor: Colors.blue),
      pane: fluent.NavigationPane(
        selected: topIndex,
        onChanged: (index) => setState(() => topIndex = index),
        displayMode: fluent.PaneDisplayMode.auto,
        items: [
          fluent.PaneItem(
            icon: const Icon(Icons.baby_changing_station),
            title: const Text('Home'),
            body: dashboard(),
          ),
          fluent.PaneItem(
            icon: const Icon(Icons.baby_changing_station),
            title: const Text('Track an order'),
            body: WorkerProfilePage(worker!),
          ),
          fluent.PaneItemExpander(
            icon: const Icon(Icons.baby_changing_station),
            title: const Text('Account'),
            body: Container(),
            items: [
              fluent.PaneItem(
                icon: const Icon(Icons.baby_changing_station),
                title: const Text('Mail'),
                body: WorkerProfilePage(worker!),
              ),
              fluent.PaneItem(
                icon: const Icon(Icons.baby_changing_station),
                title: const Text('Calendar'),
                body: WorkerTimesheetPage(worker!),
              ),
              fluent.PaneItem(
                icon: const Icon(Icons.baby_changing_station),
                title: const Text('Calendar'),
                body: const JobTrackingCalendarPage(),
              ),
            ],
          ),
        ],
      ),
    );
  }

My Error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:fluent_ui/src/controls/flyouts/flyout.dart': Failed assertion: line 470 pos 12: 'isAttached': This controller must be attached to a FlyoutTarget
package:fluent_ui/…/flyouts/flyout.dart:470
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 FlyoutController._ensureAttached
package:fluent_ui/…/flyouts/flyout.dart:470
#3 FlyoutController.showFlyout
package:fluent_ui/…/flyouts/flyout.dart:544
#4 __PaneItemExpanderState.toggleOpen
package:fluent_ui/…/navigation_view/pane_items.dart:702
#5 __PaneItemExpanderState.build.
package:fluent_ui/…/navigation_view/pane_items.dart:806
#6 PaneItem.build.
package:fluent_ui/…/navigation_view/pane_items.dart:140
#7 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:253
#8 TapGestureRecognizer.handleTapUp
package:flutter/…/gestures/tap.dart:627
#9 BaseTapGestureRecognizer._checkUp
package:flutter/…/gestures/tap.dart:306
#10 BaseTapGestureRecognizer.acceptGesture
package:flutter/…/gestures/tap.dart:276
#11 GestureArenaManager.sweep
package:flutter/…/gestures/arena.dart:163
#12 GestureBinding.handleEvent
package:flutter/…/gestures/binding.dart:464
#13 GestureBinding.dispatchEvent
package:flutter/…/gestures/binding.dart:440
#14 RendererBinding.dispatchEvent
package:flutter/…/rendering/binding.dart:336
#15 GestureBinding._handlePointerEventImmediately
package:flutter/…/gestures/binding.dart:395
#16 GestureBinding.handlePointerEvent
package:flutter/…/gestures/binding.dart:357
#17 GestureBinding._flushPointerEventQueue
package:flutter/…/gestures/binding.dart:314
#18 GestureBinding._handlePointerDataPacket
package:flutter/…/gestures/binding.dart:295
#19 _invoke1 (dart:ui/hooks.dart:164:13)
#20 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
#21 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants