[Flutter]AppBarを角丸にするには?

Flutter

どうも、ちょげ(@chogetarou)です。

AppBarを角丸にするには、どうしたらいいのでしょうか?

スポンサーリンク

方法

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "Title",
        ),
        shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(40)
        ),
      ),
      body: Center(),
    );
  }

AppBarを角丸にするには、引数「shape」を使います。

この引数に、「RoundedRectangleBorder」を指定することで、角丸のAppBarにすることが出来ます。

コメント

タイトルとURLをコピーしました