flutterdartflutter-image

The argument type 'Image' can't be assigned to the parameter type 'ImageProvider<Object>'


I tried the container I put image.net work in the child it works but I need to custom border of the image. How should I fix it?

    Expanded(child: Align(alignment:Alignment.center,
        child: Container(
          height: 45, //height, //155,
          width: 45, //width, //155,
          decoration: BoxDecoration(
            color: const Color(0xff7c94b6),
            image: DecorationImage(
            image: Image.network(state
              .offerConfirm
              .ownImage[index]),
         fit: BoxFit.cover,
        ),
        borderRadius: BorderRadius.circular(12),
         ),
        ),
      ),
     flex: 3,
  ),

                                        

enter image description here


Solution

  • Change image decoration to :

    decoration: BoxDecoration(
          image: DecorationImage(image: NetworkImage("urlImage"),
          fit: BoxFit.cover)
        ),
    
    

    Full code :

    Expanded(
                                                child: Align(
                                                  alignment: Alignment.center,
                                                  child: Container(
                                                    height: 45, //height, //155,
                                                    width: 45, //width, //155,
                                                    decoration: BoxDecoration(
                                                      color:
                                                          const Color(0xff7c94b6),
                                                      image: DecorationImage(
                                                        image: NetworkImage(state
                                                            .offerConfirm
                                                            .ownImage[index])
                                                        fit: BoxFit.cover,
                                                      ),
                                                      borderRadius:
                                                          BorderRadius.circular(12),
                                                    ),
                                                  ),
                                                ),
                                                flex: 3,
                                              ),