akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 377 forks source link

Cannot Center 'header' #332

Open GitGud31 opened 1 year ago

GitGud31 commented 1 year ago

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

Smartphone (please complete the following information):

Sample main.dart

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

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

NicolasDurant commented 6 months ago

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,
            ),
          ),
        ),
...