どうも、ちょげ(@chogetarou)です。
DatePickerには、入力する方法として、カレンダーとテキストがあります。
DatePickerをカレンダー入力のみにするには、どうしたらいいのでしょうか?
方法

final newDate = await showDatePicker(
context: context,
initialDate: initialDate,
firstDate: DateTime(DateTime.now().year - 3),
lastDate: DateTime(DateTime.now().year + 3),
initialEntryMode: DatePickerEntryMode.calendarOnly
);
カレンダーの入力設定をするには、引数「initialEntryMode」を使います。
この引数に、「DatePickerEntryMode.calendarOnly」を指定することで、カレンダーのみの入力にすることが出来ます。
コメント