[Flutter]透明色を指定するには?

Flutter

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

透明色を指定する方法を紹介します。

スポンサーリンク

方法

インターフェース, インターネット, プログラム, ブラウザ, Www

透明色を指定するには、Colorsを使います。

具体的には、Colors.transparentを、透明色にする所に指定します。

Colors.transparent

Colors.transparentを指定すれば、透明色にできます。

使用例

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Center(
            child: Stack(
          children: [
            Container(
              height: 50,
              width: 50,
              color: Colors.blue,
            ),
            Container(
              height: 100,
              width: 100,
              decoration: BoxDecoration(
                color: Colors.transparent,
                border: Border.all(),
              ),
            ),
          ],
        )),
      ),
    );
  }

コメント

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