fix: add correct spacing around calendar day header

This commit is contained in:
Freek van de Ven 2024-07-11 13:20:51 +02:00 committed by Bart Ribbers
parent 440b1e7caa
commit 1b8aa07874
2 changed files with 15 additions and 17 deletions

View file

@ -113,7 +113,7 @@ class CalendarView extends StatelessWidget {
return Column(
children: [
monthDateSelector,
const Divider(),
const Divider(height: 1),
const SizedBox(height: 20),
calendarGrid,
],

View file

@ -43,28 +43,26 @@ class CalendarGrid extends StatelessWidget {
return translations.weekDayAbbreviatedFormatter(context, day);
});
var calendarDaysRow = GridView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: 7,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
crossAxisSpacing: 12,
mainAxisSpacing: 0,
),
itemBuilder: (context, index) {
var day = dayNames[index];
return Text(
var calendarDaysRow = Row(
children: List.generate(13, (index) {
// This adds a space between the days of the week
if ((index % 2).isOdd) return const SizedBox(width: 12);
var day = dayNames[index ~/ 2];
return Expanded(
child: Text(
day,
style: textTheme.bodyLarge,
textAlign: TextAlign.center,
),
);
},
}),
);
return Column(
children: [
calendarDaysRow,
const SizedBox(height: 10),
GridView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,