traki111
traki111

Reputation: 521

How to change border colour of OutlinedButton

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.

Upvotes: 2

Views: 1846

Answers (2)

eeqk
eeqk

Reputation: 3862

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

Upvotes: 2

Ashot Khachatryan
Ashot Khachatryan

Reputation: 328

 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),
 ),

Upvotes: 2

Related Questions