どうも、ちょげ(@chogetarou)です。
TextButtonの枠線の設定をする方法を紹介します。
方法

TextButtonの枠線の設定をするには、「TextButton.styleFrom」を使います。
まず、「TextButton」の引数「style」に、「TextButton.styleFrom」を指定します。
そして、「TextButton.styleFrom」の引数「side」に「BorderSide」クラスをして指定します。
この指定した「BorderSide」クラスで、枠線の設定をします。
BorderSideクラスで設定できるのは、「枠線の色」と「枠線の太さ」です。
以下は、色と太さを設定する例です。
TextButton(
style: TextButton.styleFrom(
side: BorderSide(
color: Colors.red, //色
width: 5, //太さ
),
),
onPressed: () {},
child: Text('Button'),
)
枠線の色は「color」、枠線の太さは「width」で設定します。
コメント