Flutter OutlinedButtonを角丸にするサンプル

環境
Windows11 pro 64bit
Flutter 3.3.7

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(xxx),//角の丸み
),
),
style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(xxx),//角の丸み ), ),
style: OutlinedButton.styleFrom(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(xxx),//角の丸み
  ),
),

引数「style」に「OutlinedButton.styleFrom」を指定します。
指定した「RoundedRectangleBorder」の引数「borderRadius」で、角丸の設定をします。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
OutlinedButton(
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),//角の丸み
),
),
onPressed: () {},
child: Text('表示'),
)
OutlinedButton( style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20),//角の丸み ), ), onPressed: () {}, child: Text('表示'), )
OutlinedButton(
  style: OutlinedButton.styleFrom(
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(20),//角の丸み
    ),
  ),
  onPressed: () {},
  child: Text('表示'),
)

 

Flutter

Posted by arkgame