imageflutterdartstackradius

How to radius image in stack in flutter


i want to radius image in stack can anyone help me please :

this is part of my code :

InkWell(
       

   child: Stack(
              children: <Widget>[
                new Image.asset('assets/Images/b.jpg',fit: BoxFit.cover,),
                Center(child: Text("something",textAlign: TextAlign.center,)),
              ]
          ),
          onTap: () {
            ListOfEpisode();
            print("am");
          },
        ),

radius like this : enter image description here


Solution

  • try using container decoration.

     InkWell(
                        child: Stack(children: <Widget>[
                          Container(
                            height: 200,
                            width: 200,
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(40),
                                image: DecorationImage(
                                  image: AssetImage(
                                    'assets/Images/b.jpg',
                                  ),
                                  fit: BoxFit.cover,
                                )),
                            child: Center(
                              child: Text(
                                "something",
                                textAlign: TextAlign.center,
                              ),
                            ),
                          ),
                        ]),
                        onTap: () {
                          // ListOfEpisode();
                          // print("am");
                        },
                      ),