skip to Main Content
return InkWell(
          onTap: () => { if(1==0){
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (BuildContext context) =>
                    ImageScreen(
                      url: widget.userbio.resimler![index].toString(),
                    ),
              ),),
          }},

          child: Image.network(
            widget.userbio.resimler![index].toString(),
            fit: BoxFit.cover,


          )

      );

hello all stackoverflow users, ı need help for this. how can i add if here
child: Image.network(widget.userbio.resimler![index].toString(),fit: BoxFit.cover,

If you have any other suggestions for me to solve such problems, please do.

2

Answers


  1. You can try this:

    child: widget.userbio.resimler![index].toString().contains("keyword") ? Image.network(
        widget.userbio.resimler![index].toString(),
        fit: BoxFit.cover,
      ) : SizedBox()
    

    here if condition be true, Image would be build, if be false, SizedBox would be build.

    Login or Signup to reply.
  2. You can do something like below

    child : conditionTrue ? ImageFromNetowrk : null,
    

    OR

    child : conditionTrue ? ImageFromNetowrk : SizedBox(),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search