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]: Popover not centered #82

Open
1 of 2 tasks
lbottona opened this issue Dec 14, 2023 · 4 comments
Open
1 of 2 tasks

[Bug]: Popover not centered #82

lbottona opened this issue Dec 14, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@lbottona
Copy link

lbottona commented Dec 14, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm not sure that's a bug, but I need help. I'm trying to centered (or at least change position) of the popover in x axis. how could I do it?

Simulator Screenshot - iPhone 14 - 2023-12-14 at 15 29 23

Expected Behavior

No response

What operating system are you seeing the problem on?

iOS

Relevant log output

No response

Anything else?

`showPopover(

          context: context,
          width: 150,
          height: 100,
          direction: PopoverDirection.bottom,
          backgroundColor: Theme.of(context).colorScheme.primaryContainer,
          bodyBuilder: (context) {
            return Column(children: [
              Container(
                height: 50,
                decoration: BoxDecoration(
                  color: Theme.of(context).colorScheme.primaryContainer,
                ),
                child: Padding(
                  padding: const EdgeInsets.only(
                      left: 5, right: 5, top: 2, bottom: 2),
                  child: Row(children: [
                    Icon(Icons.edit),
                    SizedBox(width: 5),
                    Text("Modifica",
                        style: GoogleFonts.montserrat(
                          color: Colors.white,
                          fontSize: 16,
                          fontWeight: FontWeight.w500,
                        ))
                  ]),
                ),
              ),
              Container(
                height: 50,
                decoration: BoxDecoration(
                  color: Theme.of(context).colorScheme.primaryContainer,
                ),
              ),
            ]);
          });`

Code of Conduct

  • I agree to follow this project's Code of Conduct
@lbottona lbottona added the bug Something isn't working label Dec 14, 2023
@minikin minikin removed the bug Something isn't working label Dec 14, 2023
@minikin
Copy link
Owner

minikin commented Dec 14, 2023

@lbottona Thanks for submitting a ticket. I don't know how you want to center a popover.
Can you provide a more detailed code example and explain the expected behavior?

@lbottona
Copy link
Author

lbottona commented Dec 15, 2023

Yeh sorry @minikin, thank you! The popover in the image is done with the code written below. I would center the popover horizontally (x axis). I saw, for example, that I could set vertical offset, but not horizontal.
That popover is shown after clicking the card with the text "Test", so I would the popover horizontally centered

@jeremanuel
Copy link

I have the same problem.. when the popover is near the edge of the window, it stop being centered on x axis.

clipbug.mp4

@minikin minikin added help wanted Extra attention is needed and removed waiting for customer feedback labels Feb 7, 2024
@fazaamajdeddine
Copy link

fazaamajdeddine commented Apr 5, 2024

wrap your parent widget with Builder

Builder(builder: (context) {
return YourWidget(
 onPressed: () {
  showPopover(//rest of your code);
);
}

then the postition of your popover depend on the position of the parent widget , if your widget was positionned in the center of the screen , it display the popover around it (bottom,left,right or top of your widget)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants