Faheem Ahmad
Faheem Ahmad

Reputation: 173

Getting this error on tap function to see an image in a dialog box

onTap: () { showDialog( context: context, builder: (BuildContext context) { return ImageNetwork( image: data['image'].toString(), height: 400, width: 400, duration: 1000, curve: Curves.easeIn, onPointer: true, fitAndroidIos: BoxFit.cover, fitWeb: BoxFitWeb.cover, borderRadius: BorderRadius.circular(50), onLoading: const CircularProgressIndicator( color: Colors.amber, ), ); });

GET THIS ERROR: enter image description here

Upvotes: 3

Views: 198

Answers (2)

Aditya
Aditya

Reputation: 330

Wrap your ImageNetwork() widget inside Material Widget

And set type to MaterialType.transparency

showDialog(
  context: context,
  builder: (context) => Material(
  type: MaterialType.transparency,
  child: YourWidget(...)
)

Upvotes: 3

Kashif Niaz
Kashif Niaz

Reputation: 277

Use Dialog widget over your ImageNetwork widget. This will resolve your issue.


onTap:() {
        showDialog(context: context, builder: (BuildContext context) {
          return Dialog(
           child: ImageNetwork(image: data['image'].toString(),
            height: 400,
            width: 400,
            duration: 1000,
            curve: Curves.easeIn,
            onPointer: true,
            fitAndroidIos: BoxFit.cover,
            fitWeb: BoxFitWeb.cover,
            borderRadius: BorderRadius.circular(50),
            onLoading: const CircularProgressIndicator(color: Colors.amber,),),`enter code here`);
        });
      }

Upvotes: 2

Related Questions