【发布时间】:2021-12-14 02:46:36
【问题描述】:
这是我遇到问题的小部件部分
DateTime? _selectedDate;
(...)
Container(
height: 70,
child: Row(children: [
Text(_selectedDate == null
? 'No date chosen!'
: DateFormat.yMd(_selectedDate)),
TextButton(
child: Text(
'Choose date',
style: TextStyle(fontWeight: FontWeight.bold),
),
onPressed: _presentDatePicker,
)
]),
),
(...)
当我检查 _selectedDate 是否为空,插入 Text 小部件时,就会出现问题,就像我在图像上显示的那样
【问题讨论】: