header_style.dart
3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright (c) 2019 Aleksander Woźniak
// Licensed under Apache License v2.0
part of table_calendar;
/// Class containing styling and configuration of `TableCalendar`'s header.
class HeaderStyle {
/// Responsible for making title Text centered.
final bool centerHeaderTitle;
/// Responsible for FormatButton visibility.
final bool formatButtonVisible;
/// Controls the text inside FormatButton.
/// * `true` - the button will show next CalendarFormat
/// * `false` - the button will show current CalendarFormat
final bool formatButtonShowsNext;
/// Use to customize header's title text (eg. with different `DateFormat`).
/// You can use `String` transformations to further customize the text.
/// Defaults to simple `'yMMMM'` format (eg. January 2019, February 2019, March 2019, etc.).
///
/// Example usage:
/// ```dart
/// titleTextBuilder: (date, locale) => DateFormat.yM(locale).format(date),
/// ```
final TextBuilder? titleTextBuilder;
/// Style for title Text (month-year) displayed in header.
final TextStyle titleTextStyle;
/// Style for FormatButton `Text`.
final TextStyle formatButtonTextStyle;
/// Background `Decoration` for FormatButton.
final Decoration formatButtonDecoration;
/// Inside padding of the whole header.
final EdgeInsets headerPadding;
/// Outside margin of the whole header.
final EdgeInsets? headerMargin;
/// Inside padding for FormatButton.
final EdgeInsets formatButtonPadding;
/// Inside padding for left chevron.
final EdgeInsets leftChevronPadding;
/// Inside padding for right chevron.
final EdgeInsets rightChevronPadding;
/// Outside margin for left chevron.
final EdgeInsets leftChevronMargin;
/// Outside margin for right chevron.
final EdgeInsets rightChevronMargin;
/// Icon used for left chevron.
/// Defaults to `Icons.chevron_left`.
final Icon leftChevronIcon;
/// Icon used for right chevron.
/// Defaults to `Icons.chevron_right`.
final Icon rightChevronIcon;
/// Determines left chevron's visibility.
/// Defaults to `true`.
final bool leftChevronVisible;
/// Determines right chevron's visibility.
/// Defaults to `true`.
final bool rightChevronVisible;
/// Header decoration, used to draw border or shadow or change color of the header
/// Defaults to empty BoxDecoration.
final BoxDecoration decoration;
const HeaderStyle({
this.centerHeaderTitle = false,
this.formatButtonVisible = true,
this.formatButtonShowsNext = true,
this.titleTextBuilder,
this.titleTextStyle = const TextStyle(fontSize: 17.0),
this.formatButtonTextStyle = const TextStyle(),
this.formatButtonDecoration = const BoxDecoration(
border: const Border(
top: BorderSide(),
bottom: BorderSide(),
left: BorderSide(),
right: BorderSide(),
),
borderRadius: const BorderRadius.all(Radius.circular(12.0)),
),
this.headerMargin,
this.headerPadding = const EdgeInsets.symmetric(vertical: 8.0),
this.formatButtonPadding =
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
this.leftChevronPadding = const EdgeInsets.all(12.0),
this.rightChevronPadding = const EdgeInsets.all(12.0),
this.leftChevronMargin = const EdgeInsets.symmetric(horizontal: 8.0),
this.rightChevronMargin = const EdgeInsets.symmetric(horizontal: 8.0),
this.leftChevronIcon = const Icon(Icons.chevron_left),
this.rightChevronIcon = const Icon(Icons.chevron_right),
this.leftChevronVisible = true,
this.rightChevronVisible = true,
this.decoration = const BoxDecoration(),
});
}