如何在flutter中自定义表格日历标题

问题描述 投票:0回答:2

默认表格日历标题:

预期标题:

默认日历标题显示屏幕左侧和右侧的图标以及中间的文本。但我想像第二张图片一样定制。

我尝试过标题样式方法,仅更改颜色和样式,但不更改其位置。请帮忙..

flutter calendar header customization
2个回答
1
投票

我给你的建议是创建你自己的标题并将其链接到 callendar,这也是我自己在类似情况下所做的。 您可以通过隐藏 callendar 的原始标头来做到这一点

headerVisible: false

然后您可以添加一个 Row() 例如并添加您想要的小部件


0
投票

你可以使用这样的东西:

calendarBuilders: CalendarBuilders(
headerTitleBuilder: (context, day) {
return Row(
mainAxisAlignment:MainAxisAligment.center,
children:[Text("March",Row(children:[Icon(Icons.arrow_left),
Icon(Icons.arrow_right),
],),),],),
  },
),
© www.soinside.com 2019 - 2024. All rights reserved.