Umut Arpat
Umut Arpat

Reputation: 566

How can I put an image in an alertDialog?

I want to display an image in alert dialog when user clicks on it.

How can i do that ?

GestureDetector(onTap: (){print("girdim");AlertDialog();}

Upvotes: 0

Views: 92

Answers (1)

Chiziaruhoma Ogbonda
Chiziaruhoma Ogbonda

Reputation: 411

You can easily use/build dialogs as such

await showDialog(
      context: context,
      builder: (BuildContext context) {
        return Dialog(
          elevation: 0,
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(12.0))),
          child: Container(
            width: 300,
            height: 300,
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Image.asset('your image')
                ],
              ),
            ),
          ),
        );
      },
    );

Upvotes: 2

Related Questions