skip to Main Content
showDialog(
        context: context,
        barrierDismissible: false,
        // barrierLabel: 'barrierLabel',
        builder: (BuildContext context) {
          return Center(
            child: Container(
              width: 100,
              height: 100,
              color: Colors.red,
            ),
          );
});

On my 8-inch tablet, the content of the view that pops up from this function only displays on the left half. Does anyone know how to center the content on the tablet? Is this a feature of the function? Is there a special setting that can be used to modify this issue?

In a Pad sized device, any pop-up widget in the body of a Scaffold will only be displayed on the left or right half when using ‘showDialog’ or ‘showModalBottomSheet’ Unable to center display

Only the components that pop up in the ‘showBottomSheet’ mode will be displayed in the center I’m confused, why is this?

I want to achieve a reminder box that covers the entire interface, which cannot be effectively displayed on devices of pad size

2

Answers


  1. Chosen as BEST ANSWER

    enter image description here

    The display effect is shown in the figure


  2. The problem has been resolved

    The abnormal display effect only appears on the simulator and is normal on real devices

    I’m very sorry, I submitted the issue to overflow without undergoing real machine testing, wasting everyone’s time

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search