[Flutter]CupertinoDatePickerの背景色を設定するには?

Flutter

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

CupertinoDatePickerの背景色を設定する方法を紹介します。

スポンサーリンク

方法

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

CupertinoDatePickerの背景色を設定するには、引数「backgroundColor」を使います。

具体的には、CupertinoDatePickerの引数「backgroundColor」に背景色を指定します。

CupertinoDatePicker(
  backgroundColor: /*背景色/,
  ・・・・
),

引数「backgroundColor」を使えば、CupertinoDatePickerの背景色を設定することができます。

使用例

以下は、使用例です。

CupertinoDatePicker(
  backgroundColor: Colors.blue[100],
  initialDateTime: _selectDate,
  onDateTimeChanged: (newDate) {
    setState(() {
      _selectDate = newDate;
    });
  },
),

コメント

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