Flutter Simple Dialog content going off the screen

490 views Asked by At

I have a dialog I am trying to wrap the content in the dialog however I am having few problems

1)Use of wrap does not guarantee that content is in the alert dialog box

2)alignment of content is not center.

I have tried all possible alignment and it does not work. While using column stretch the widget I thought maybe using wrap will work . But it does not. Any solution?

with wrap

With Column

with column

With Colored Container in a wrap to check the issue and with size box with defined width of display * 0.25 so that text does not go away from screen

with container in wrap

Code

 showDialog(
      barrierDismissible: false,
      barrierColor: Colors.black26,
      context: context,
      builder: (context) {
        return StatefulBuilder(
          builder: (context, setState) {
            return AlertDialog(
              contentPadding: EdgeInsets.all(20),
              content: Wrap(
                direction: Axis.vertical,
                alignment: WrapAlignment.spaceAround,
                runAlignment: WrapAlignment.center,
                crossAxisAlignment: WrapCrossAlignment.center,
                runSpacing: 10,
                children: [
                  Lottie.asset(
                      Constants.location_anim,
                      height: displaySize.height * 0.25,
                      repeat: true,
                      reverse: true,
                      animate: true
                  ),
                  Text(locationMsgTextView,softWrap: true,),
                  getLocationDeniedWidget(context,state),
                ],
              ),
              elevation: 3,
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20)),
            );
          },
        );
      });
0

There are 0 answers