buildWidget method
构建主体
Implementation
@override
Widget buildWidget(XBCalendarMonthCellVM vm, BuildContext context) {
return SizedBox(
height: month.height,
child: Stack(
children: [
Positioned(
top: 50,
left: 0,
right: 0,
bottom: 0,
child: Container(
alignment: Alignment.center,
child: Text(
"${month.month}",
style:
TextStyle(fontSize: 100, color: Colors.black.withAlpha(10)),
),
),
),
Positioned(
top: 0,
left: 0,
right: 0,
child: Container(
height: xbCalendarMonthH,
alignment: Alignment.center,
child: Text(
"${month.year} $yearUnit ${month.month} $monthUnit"))),
Positioned(
top: 50,
left: 0,
right: 0,
bottom: 0,
child: GestureDetector(
onTapDown: (details) {
vm.position = details.localPosition;
},
onTap: vm.onTap,
child: CustomPaint(
size: Size(screenW, month.height - xbCalendarMonthH),
painter: XBCalendarPainter(
month: month,
daySize: Size(
xbCalendarDayW, xbCalendarDayH ?? xbCalendarDayW),
display: display),
),
))
],
),
);
}