How to change border colour of OutlinedButton

1

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.

flutter
button
asked on Stack Overflow Apr 27, 2021 by traki111

2 Answers

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),
 ),
answered on Stack Overflow Apr 27, 2021 by Ashot Khachatryan
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

answered on Stack Overflow Apr 27, 2021 by mightybruno

User contributions licensed under CC BY-SA 3.0