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

No Directionality widget found. #130

Closed
hugo-sna opened this issue Aug 22, 2023 · 3 comments
Closed

No Directionality widget found. #130

hugo-sna opened this issue Aug 22, 2023 · 3 comments

Comments

@hugo-sna
Copy link
Contributor

hugo-sna commented Aug 22, 2023

The library doesn't work at all because of No Directionality widget found.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building RawGestureDetector(state:
RawGestureDetectorState#03867(gestures: [horizontal drag], behavior: translucent)):
No Directionality widget found.
Stack widgets require a Directionality widget ancestor to resolve the 'alignment' argument.
The default value for 'alignment' is AlignmentDirectional.topStart, which requires a text direction.
The specific widget that could not find a Directionality ancestor was:
  Stack
The ownership chain for the affected widget is: "Stack ← Listener ← _GestureSemantics ←
  RawGestureDetector ← GestureDetector ← ZoomDrawer ← MyApp ← MediaQuery ← _MediaQueryFromView ←
  _ViewScope ← ⋯"
Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the
top of your application widget tree. It determines the ambient reading direction and is used, for
example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve
EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.
Instead of providing a Directionality widget, another solution would be passing a non-directional
'alignment', or an explicit 'textDirection', to the Stack.

The relevant error-causing widget was:
  GestureDetector
@medyas
Copy link
Owner

medyas commented Aug 23, 2023

@hugo-sna could you provide a full sample

@hugo-sna
Copy link
Contributor Author

My main file only contains the widget

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return ZoomDrawer(
      mainScreen: HomePage(),
      menuScreen: Menu(),
    );
  }
}

And the full exception

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building RawGestureDetector(state:
RawGestureDetectorState#03867(gestures: [horizontal drag], behavior: translucent)):
No Directionality widget found.
Stack widgets require a Directionality widget ancestor to resolve the 'alignment' argument.
The default value for 'alignment' is AlignmentDirectional.topStart, which requires a text direction.
The specific widget that could not find a Directionality ancestor was:
  Stack
The ownership chain for the affected widget is: "Stack ← Listener ← _GestureSemantics ←
  RawGestureDetector ← GestureDetector ← ZoomDrawer ← MyApp ← MediaQuery ← _MediaQueryFromView ←
  _ViewScope ← ⋯"
Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the
top of your application widget tree. It determines the ambient reading direction and is used, for
example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve
EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.
Instead of providing a Directionality widget, another solution would be passing a non-directional
'alignment', or an explicit 'textDirection', to the Stack.

The relevant error-causing widget was:
  GestureDetector
  GestureDetector:file:///C:/Users/Nougator/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_zoom_drawer-3.0.1/lib/flutter_zoom_drawer.dart:729:23

When the exception was thrown, this was the stack:
#0      debugCheckHasDirectionality.<anonymous closure> (package:flutter/src/widgets/debug.dart:353:7)
#1      debugCheckHasDirectionality (package:flutter/src/widgets/debug.dart:373:4)
#2      Stack._debugCheckHasDirectionality (package:flutter/src/widgets/basic.dart:3911:14)
#3      Stack.createRenderObject (package:flutter/src/widgets/basic.dart:3923:12)
#4      RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5932:52)
#5      MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6577:11)
...     Normal element mounting (7 frames)
#12     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3971:16)
#13     Element.updateChild (package:flutter/src/widgets/framework.dart:3702:20)
#14     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16)
#15     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5251:11)
#16     Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#17     StatefulElement.update (package:flutter/src/widgets/framework.dart:5274:5)
#18     Element.updateChild (package:flutter/src/widgets/framework.dart:3686:15)
#19     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16)
#20     Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#21     StatelessElement.update (package:flutter/src/widgets/framework.dart:5162:5)
#22     Element.updateChild (package:flutter/src/widgets/framework.dart:3686:15)
#23     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16)
#24     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5251:11)
#25     Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#26     StatefulElement.update (package:flutter/src/widgets/framework.dart:5274:5)
#27     Element.updateChild (package:flutter/src/widgets/framework.dart:3686:15)
#28     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16)
#29     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5251:11)
#30     Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#31     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2780:19)
#32     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:903:21)
#33     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:358:5)
#34     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1284:15)
#35     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1214:9)
#36     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:939:7)
#40     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 3 frames from class _Timer and dart:async-patch)

@medyas
Copy link
Owner

medyas commented Aug 23, 2023 via email

@medyas medyas closed this as completed Aug 25, 2023
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

2 participants