[Flutter]MaterialButtonにリップルエフェクトを付ける方法

Flutter

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

MaterialButtonにリップルエフェクトを付ける方法を紹介します。

スポンサーリンク

方法

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

MaterialButtonにリップルエフェクトを追加するには、引数「splashColor」に透明色以外の色を指定します。

MaterialButton(
  splashColor: Colors.pink,
  onPressed: () {},
  color: Colors.blue,
  textColor: Colors.white,
  child: Text('Button'),
)

「splashColor」は、リップルエフェクトの色です。

この引数を設定することで、MaterialButtonにリップルエフェクトが追加されます。

コメント

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