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

[Bug]: Theme is not being captured before popover is pushed #86

Open
2 tasks done
Okizeme opened this issue Apr 9, 2024 · 1 comment
Open
2 tasks done

[Bug]: Theme is not being captured before popover is pushed #86

Okizeme opened this issue Apr 9, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Okizeme
Copy link

Okizeme commented Apr 9, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The bodyBuilder provides a context that is not inherited from the context parameter of the showPopover() function, resulting in Material's default colors being used instead of the app's theme colors.

Expected Behavior

As done in dialog.dart of Google's Material package, the theme from the context should be captured and passed to the RawDialogRoute.push()
Exemple from the Material lib:

final CapturedThemes themes = InheritedTheme.capture(
    from: context,
    to: Navigator.of(
      context,
      rootNavigator: useRootNavigator,
    ).context,
  );

What operating system are you seeing the problem on?

macOS, iOS, Android, Windows

Relevant log output

No response

Anything else?

Work around would be to wrap the return of the bodyBuilder in a Theme widget using the previous context, like so:

showPopover(
      context: context,
      direction: PopoverDirection.bottom,
      arrowHeight: 8.0,
      arrowWidth: 16.0,
      radius: 12.0,
      width: 740.0,
      height: 400.0,
      bodyBuilder: (final ctx) {
        return Theme(
          data: context.theme,
          child: const MyWidgetInsidePopover(),
        );
      },
    );

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Okizeme Okizeme added the bug Something isn't working label Apr 9, 2024
@minikin
Copy link
Owner

minikin commented Apr 18, 2024

@Okizeme, Thank you for the reporting. Feel free to create a PR to address the issue.

@minikin minikin added the help wanted Extra attention is needed label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants