defaultBuildMonthHead function

Widget defaultBuildMonthHead(
  1. BuildContext context,
  2. DateMonth month, {
  3. VoidCallback? onLast,
  4. VoidCallback? onNext,
  5. VoidCallback? onClear,
})

默认构建月视图头部

Implementation

Widget defaultBuildMonthHead(BuildContext context, DateMonth month,
    {VoidCallback? onLast, VoidCallback? onNext, VoidCallback? onClear}) {
  return Stack(children: [
    Container(
      padding: EdgeInsets.all(10),
      alignment: Alignment.center,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          onLast == null
              ? Container()
              : IconButton(
                  icon: Icon(Icons.chevron_left, color: Color(0x73000000)),
                  onPressed: onLast),
          Text(month.toString(yearSuffix: '年', monthSuffix: '月'),
              style: TextStyle(fontSize: 20, color: Color(0xd9000000))),
          onNext == null
              ? Container()
              : IconButton(
                  icon: Icon(Icons.chevron_right, color: Color(0x73000000)),
                  onPressed: onNext),
        ],
      ),
    ),
    Positioned(
        top: 10,
        right: 10,
        child: onClear == null
            ? Container()
            : IconButton(
                icon: Icon(Icons.delete_forever),
                onPressed: onClear,
                color: Colors.red))
  ]);
}