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

1,014

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

Share:
1,014
siitaw
Author by

siitaw

Updated on December 31, 2022

Comments

  • siitaw
    siitaw over 1 year

    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?

  • siitaw
    siitaw over 2 years
    when I've put this in container T I've get error in emulator
  • Ardeshir ojan
    Ardeshir ojan over 2 years
    @faezehajimohammadhoseini what was your error?
  • Ardeshir ojan
    Ardeshir ojan over 2 years
    oh I get it if you define decoration and box decoration you should define color inside the box decoration
  • Jahidul Islam
    Jahidul Islam over 2 years
    onTap working on my emulator. what about the response you got?
  • siitaw
    siitaw over 2 years
    when I've click on items ,I've get nothing