简体   繁体   English

我们如何调整flutter中table_calendar的header高度

[英]How Can we adjust header height of a table_calendar in flutter

The default height of calendar header is too high how can I resize it to make the blue part of the calendar a little bit smaller日历header的默认高度太高了怎么调整才能让日历的蓝色部分变小一点

在此处输入图像描述] ]

 Container(
  decoration: const BoxDecoration(
      color: Colors.white,
      borderRadius: BorderRadius.only(
          bottomLeft: Radius.circular(20),
          bottomRight: Radius.circular(20),
          topLeft: Radius.circular(40),
          topRight: Radius.circular(40))),
  
  child: TableCalendar(

    daysOfWeekStyle: const DaysOfWeekStyle(
        decoration: BoxDecoration(color: Colors.white)),
    daysOfWeekHeight: 20,

    calendarFormat: CalendarFormat.week,
    weekendDays: const [DateTime.sunday],
    calendarStyle: CalendarStyle(


       
        todayDecoration: BoxDecoration(
            borderRadius: BorderRadius.circular(20),
            gradient: const LinearGradient(
                colors: [Color(0xFF20264B), Color(0xFF213BCE)],
                begin: Alignment.centerLeft,
                end: Alignment.centerRight)),
        rowDecoration: const BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(20),
                bottomRight: Radius.circular(20))),
        weekendTextStyle: const TextStyle(color: Colors.red)),
    headerStyle: HeaderStyle(
      headerMargin: EdgeInsets.only(bottom: 10),
        titleTextStyle: const TextStyle(color: Colors.white, fontSize: 20),
        decoration: BoxDecoration(
          shape: BoxShape.rectangle,
            borderRadius: BorderRadius.circular(50),
            gradient: const LinearGradient(

                colors: [Color(0xFF20264B), Color(0xFF213BCE)],
                begin: Alignment.centerLeft,
                end: Alignment.centerRight)),
        formatButtonVisible: false,
        titleCentered: true,
       
       
    firstDay: DateTime.utc(2010, 10, 16),
    lastDay: DateTime.utc(2030, 3, 14),
    focusedDay: DateTime.now(),

  ),
);

I've tried and checked many possible ways but none of it worked as there is no property for adjust height in the package. So if anyone can suggest me a workaround or a solution then it'd be really appreciated.我已经尝试并检查了许多可能的方法,但都没有奏效,因为 package 中没有调整高度的属性。因此,如果有人可以建议我解决方法或解决方案,那么我将不胜感激。

Have you tried headerStyle property?您是否尝试过headerStyle属性? to adjust the height of the calendar header调整日历的高度 header

 TableCalendar(
  headerStyle: HeaderStyle(
    height: 50, 
    .........

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM