Flutter “颤振日历旋转木马”选择会移动日历日期
我正在使用Flatter calendar carousel 1.4.0版,并体验到这种奇怪的行为,即当我移动月份并选择一天(仅第一次选择)时,日历将移动1天。我附上了日历行为的代码和gif Gif: 代码:Flutter “颤振日历旋转木马”选择会移动日历日期,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我正在使用Flatter calendar carousel 1.4.0版,并体验到这种奇怪的行为,即当我移动月份并选择一天(仅第一次选择)时,日历将移动1天。我附上了日历行为的代码和gif Gif: 代码: DateTime _selectedDate = DateTime.now(); EventList<Event> _markedDateMap; Widget _calendarWidget() { return Container( //a
DateTime _selectedDate = DateTime.now();
EventList<Event> _markedDateMap;
Widget _calendarWidget() {
return Container(
//alignment: Alignment.topLeft,
margin: EdgeInsets.symmetric(horizontal: 50.0),
child: CalendarCarousel<Event>(
onDayPressed: (DateTime date, List<Event> events) {
this.setState(() => _selectedDate = date);
},
weekendTextStyle: TextStyle(
color: Colors.red,
),
headerTextStyle: TextStyle(fontFamily: 'Nunito', fontWeight: FontWeight.bold, fontSize: FontSize.m, color: Colors.deepPurple),[![enter image description here][1]][1]
selectedDayButtonColor: Colors.deepPurple,
selectedDayBorderColor: Colors.deepPurple,
weekFormat: false,
markedDatesMap: _markedDateMap,
height: MediaQuery.of(context).size.height * 0.5,
selectedDateTime: _selectedDate,
daysHaveCircularBorder: null, /// null for not rendering any border, true for circular border, false for rectangular border
),
);
}
DateTime\u selectedDate=DateTime.now();
事件列表(标记日期图);;
小部件_calendarWidget(){
返回容器(
//对齐:alignment.topLeft,
边缘:边缘组。对称(水平:50.0),
孩子:日历旋转木马(
onDayPressed:(日期时间日期,列出事件){
此.setState(()=>_selectedDate=date);
},
weekendTextStyle:TextStyle(
颜色:颜色,红色,
),
headerTextStyle:TextStyle(fontFamily:'Nunito',fontWeight:fontWeight.bold,fontSize:fontSize.m,颜色:Colors.deepPurple),[![在此处输入图像描述][1][1]
SelectedDayButton颜色:Colors.deepPurple,
selectedDayBorderColor:Colors.deepPurple,
周格式:假,
markedDatesMap:_markedDateMap,
高度:MediaQuery.of(上下文).size.height*0.5,
selectedDateTime:\u selectedDate,
DayshaveCircularOrder:null,///null表示不呈现任何边框,true表示圆形边框,false表示矩形边框
),
);
}
对于可能遇到相同问题的任何人,我做了一些尝试,错误是由于CalendarCarousel中的“showHeader”字段导致的,停用该字段并提供自定义标题,解决了我的问题