siitaw
siitaw

Reputation: 117

flutter : can't set Border Radius for container and on Tap not work in flutter

I Have Problem about borderRadius of Container in flutter . I can't set it for container

I want to create something like this image :

enter image description here

and other problem about onTap() . ontap not work and i don't know why .

here this is part of my code:

InkWell(
                  borderRadius: BorderRadius.all(Radius.circular(5.0)),
                  child: Container(
                    padding: const EdgeInsets.all(10),
                    child: const Text("فلسفه",
                        style: TextStyle(
                          color: Color(0xFF201F1E),
                        ),
                        textAlign: TextAlign.center),
                    color: greyColor,
                  ),
                  onTap: () {
                    print("something");
                   
                  },
                ),

can any one help me please?

Upvotes: 1

Views: 4153

Answers (2)

Jahidul Islam
Jahidul Islam

Reputation: 12575

Please try with this

InkWell(
          child: Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(5),
              color: Colors.grey,
            ),
            padding: const EdgeInsets.all(10),
            child: const Text("فلسفه",
                style: TextStyle(
                  color: Color(0xFF201F1E),
                ),
                textAlign: TextAlign.center),

          ),
          onTap: () {
            print("something");

          },
        )

output:

enter image description here

Upvotes: 1

Ardeshir ojan
Ardeshir ojan

Reputation: 2419

delete this code in your inkWell

borderRadius: BorderRadius.all(Radius.circular(5.0)),

and put this in inside your Container

decoration: BoxDecoration(
   borderRadius: BorderRadius.circular(10.0),
),

this will fix your BorderRadius problem

test it i think this will fix that onTap problem as well

Upvotes: 0

Related Questions