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

Cannot Center 'header' #332

Open
GitGud31 opened this issue Jun 23, 2023 · 2 comments
Open

Cannot Center 'header' #332

GitGud31 opened this issue Jun 23, 2023 · 2 comments

Comments

@GitGud31
Copy link

GitGud31 commented Jun 23, 2023

Describe the bug
Seems like the header can't be centered

Smartphone (please complete the following information):

  • Device: Android A53
  • OS: [Android latest]
  • Flutter Version: latest
  • sliding_up_panel Version latest

Sample main.dart

Scaffold(
        body: 
            SlidingUpPanel(
              header: Center(
                child: Text("Some text in the header"),
              ),
              panel: const Center(child: Text("hi")),
            ), 
      );

@dickermoshe
Copy link

use a LayoutBuilder to get the max width and center the header in a sized box

@NicolasDurant
Copy link

Simple, and works if the user spins around the device ;)

...
header: SizedBox(
          width: MediaQuery.of(context).size.width,
          child: const Center(
            child: Icon(
              Icons.remove,
              size: 32,
            ),
          ),
        ),
...

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

3 participants