Widget _buildSimple(BuildContext context) { final size = MediaQuery.of(context).size; final selected = ValueNotifier>([DateTime.now().millisecondsSinceEpoch]); return ValueListenableBuilder( valueListenable: selected, builder: (context, value, child) { final date = DateTime.fromMillisecondsSinceEpoch(value[0]); return TDCellGroup( cells: [ TDCell( title: '单个选择日历', arrow: true, note: '${date.year}-${date.month}-${date.day}', onClick: (cell) { TDCalendarPopup( context, visible: true, onConfirm: (value) { print('onConfirm:$value'); selected.value = value; }, onClose: () { print('onClose'); }, child: TDCalendar( title: '请选择日期', value: value, height: size.height * 0.6 + 176, onCellClick: (value, type, tdate) { print('onCellClick:$value'); }, onCellLongPress: (value, type, tdate) { print('onCellLongPress:$value'); }, onHeanderClick: (index, week) { print('onHeanderClick:$week'); }, onChange: (value) { print('onChange:$value'); }, ), ); }, ), TDCell( title: '多个选择日历', arrow: true, onClick: (cell) { TDCalendarPopup( context, visible: true, child: TDCalendar( title: '请选择日期', type: CalendarType.multiple, value: [DateTime.now().millisecondsSinceEpoch], height: size.height * 0.6 + 176, ), ); }, ), TDCell( title: '区间选择日历', arrow: true, onClick: (cell) { TDCalendarPopup( context, visible: true, child: TDCalendar( title: '请选择日期区间', type: CalendarType.range, value: [ DateTime.now().millisecondsSinceEpoch, DateTime.now().add(const Duration(days: 6)).millisecondsSinceEpoch, ], height: size.height * 0.6 + 176, ), ); }, ), TDCell( title: '单个选择日历和时间', arrow: true, note: '${date.year}-${date.month}-${date.day} ${date.hour}:${date.minute}', onClick: (cell) { TDCalendarPopup( context, visible: true, onConfirm: (value) { print('onConfirm:$value'); selected.value = value; }, onClose: () { print('onClose'); }, child: TDCalendar( title: '请选择日期和时间', value: value, height: size.height * 0.92, useTimePicker: true, onCellClick: (value, type, tdate) { print('onCellClick:$value'); }, onCellLongPress: (value, type, tdate) { print('onCellLongPress:$value'); }, onHeanderClick: (index, week) { print('onHeanderClick:$week'); }, onChange: (value) { print('onChange:$value'); }, ), ); }, ), TDCell( title: '区间选择日历和时间', arrow: true, onClick: (cell) { TDCalendarPopup( context, visible: true, onConfirm: (value) { print('onConfirm:$value'); }, onClose: () { print('onClose'); }, child: TDCalendar( title: '请选择日期和时间区间', height: size.height * 0.92, type: CalendarType.range, value: [ DateTime.now().millisecondsSinceEpoch, DateTime.now().add(const Duration(days: 3)).millisecondsSinceEpoch, ], useTimePicker: true, onCellClick: (value, type, tdate) { print('onCellClick:$value'); }, onCellLongPress: (value, type, tdate) { print('onCellLongPress:$value'); }, onHeanderClick: (index, week) { print('onHeanderClick:$week'); }, onChange: (value) { print('onChange:$value'); }, ), ); }, ), ], ); }, ); }