How to change border colour of OutlinedButton

448

Solution 1

Specify side parameter of a ButtonStyle

ButtonStyle(
  side: MaterialStateProperty.all(BorderSide(color: Colors.deepOrange)),
  shape: MaterialStateProperty.all(
    RoundedRectangleBorder(
      side: BorderSide(color: Colors.deepOrange),
      borderRadius: BorderRadius.circular(25.0),
    ),
  ),
)

enter image description here

Solution 2

 OutlinedButton(
     onPressed: null,
     style: OutlinedButton.styleFrom(
          side: BorderSide(color: Colors.red, width: 5),
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(25))),
     child: const Text("Kontynuuj jako gość",
          style: TextStyle(fontSize: 20, color: Color(0xffffffff)),
          textAlign: TextAlign.center),
 ),
Share:
448
traki111
Author by

traki111

Updated on December 29, 2022

Comments

  • traki111
    traki111 over 1 year

    I would like to change border color of OutlinedButton. Could you tell me how to do it?

    OutlinedButton(
                  onPressed: null,
                  style: ButtonStyle(
                    shape: MaterialStateProperty.all(
                      RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(25.0),
                      ),
                    ),
                  ),
                  child: const Text("Kontynuuj jako gość",
                      style: TextStyle(fontSize: 20, color: Color(0xffffffff)),
                      textAlign: TextAlign.center),
                ),
    

    I tried Cannot change border color in OutlinedButton but it does not work.

    • Lars
      Lars almost 3 years
      add a side: BordeSide(color: Colors.green), to your roundedrectangleborder.
    • traki111
      traki111 almost 3 years
      @lrsvmb does not work. Still no colour apperad