Flutter OutlinedButtonの高さを設定するサンプル

環境
Windows11 pro 64bit
Flutter 3.3.7

構文
style: OutlinedButton.styleFrom(
fixedSize: Size.fromHeight(高さ), //Sizeクラスで高さを指定
),
OutlinedButtonの引数「style」にOutlinedButton.styleFromを指定します。
styleFromの引数「fixedSize」に高さを指定します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: OutlinedButton(
style: OutlinedButton.styleFrom(
fixedSize: Size.fromHeight(100.0),
),
onPressed: () {},
child: Text('表示'),
),
),
),
);
}
@override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Center( child: OutlinedButton( style: OutlinedButton.styleFrom( fixedSize: Size.fromHeight(100.0), ), onPressed: () {}, child: Text('表示'), ), ), ), ); }
@override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Center(
          child: OutlinedButton(
            style: OutlinedButton.styleFrom(
              fixedSize: Size.fromHeight(100.0),
            ),
            onPressed: () {},
            child: Text('表示'),
          ),
        ),
      ),
    );
  }

 

IT

Posted by arkgame