feduke-nukem / flutter_easy_dialogs

Easy dialogs library for Flutter
https://pub.dev/packages/flutter_easy_dialogs
MIT License
12 stars 0 forks source link

[Bug]: Tooltip assertion error when using FlutterEasyDialogs.builder() in MaterialApp.router #33

Closed dragongesa closed 2 days ago

dragongesa commented 2 days ago

What happened?

Tooltip assertion error when using FlutterEasyDialogs.builder() in MaterialApp.router

Description

When using FlutterEasyDialogs.builder() as the builder parameter in MaterialApp.router, an assertion error is thrown when trying to select text in a TextFormField. The error prevents the text selection overlay menu (copy, paste, select all, etc.) from appearing.

Steps to Reproduce

  1. Set up a Flutter project using MaterialApp.router
  2. Add FlutterEasyDialogs.builder() as the builder parameter:
    MaterialApp.router(
     builder: FlutterEasyDialogs.builder(),
     // other parameters...
    )
  3. Include a TextFormField in your widget tree
  4. Attempt to select text in the TextFormField

Expected Behavior

The text selection overlay menu should appear when selecting text in the TextFormField.

Actual Behavior

An assertion error is thrown, and the text selection overlay menu does not appear.

Error Message

The following assertion was thrown building Tooltip("More", dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#5e000]], state: TooltipState#417a7):

No Overlay widget found.

Tooltip widgets require an Overlay widget ancestor within the closest LookupBoundary.
An overlay lets widgets float on top of other widget children.
To introduce an Overlay widget, you can either directly include one, or use a widget that contains an Overlay itself, such as a Navigator, WidgetApp, MaterialApp, or CupertinoApp.
The specific widget that could not find a Overlay ancestor was: Tooltip

Additional Information

Workaround

Removing the builder: FlutterEasyDialogs.builder() from MaterialApp.router resolves the issue, but this is not a viable solution as it removes the desired functionality of FlutterEasyDialogs.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.22.3, on macOS 15.0 24A335 darwin-arm64, locale en-ID) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.93.1) [✓] Connected device (5 available) [✓] Network resources

• No issues found!

Relevant log output

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Tooltip("More", dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#5e000]], state: TooltipState#417a7):
No Overlay widget found.
Tooltip widgets require an Overlay widget ancestor within the closest LookupBoundary.
An overlay lets widgets float on top of other widget children.
To introduce an Overlay widget, you can either directly include one, or use a widget that contains an Overlay itself, such as a Navigator, WidgetApp, MaterialApp, or CupertinoApp.
The specific widget that could not find a Overlay ancestor was: Tooltip
    "More"
    dirty
    dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#5e000]]
    state: TooltipState#417a7

Code of Conduct

feduke-nukem commented 2 days ago

Have reproduced it on Android