Skip to content

Commit 2e2ea38

Browse files
2 parents 5e993b9 + 86c8da6 commit 2e2ea38

16 files changed

Lines changed: 680 additions & 50 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Flutter Compatibility
2+
3+
on:
4+
schedule:
5+
- cron: '0 14 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
compatibility:
10+
name: Test on Flutter ${{ matrix.channel }}
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
channel:
17+
- stable
18+
- beta
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Flutter
25+
uses: subosito/flutter-action@v2
26+
with:
27+
channel: ${{ matrix.channel }}
28+
29+
- name: Show Flutter version
30+
run: flutter --version
31+
32+
- name: Install dependencies
33+
run: flutter pub get
34+
35+
- name: Analyze
36+
run: flutter analyze
37+
38+
- name: Run tests
39+
run: flutter test
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Weekly Analyze
2+
3+
on:
4+
schedule:
5+
- cron: '0 10 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
analyze:
10+
name: Analyze package
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Flutter
18+
uses: subosito/flutter-action@v2
19+
with:
20+
channel: 'stable'
21+
22+
- name: Install dependencies
23+
run: flutter pub get
24+
25+
- name: Run Flutter analyze
26+
run: flutter analyze

.github/workflows/weekly-pana.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Weekly Pana Score
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
pana:
10+
name: Check pub.dev score
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Flutter
18+
uses: subosito/flutter-action@v2
19+
with:
20+
channel: 'stable'
21+
22+
- name: Install dependencies
23+
run: flutter pub get
24+
25+
- name: Install pana
26+
run: dart pub global activate pana
27+
28+
- name: Run pana score check
29+
run: dart pub global run pana --no-warning .
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Weekly Publish Check
2+
3+
on:
4+
schedule:
5+
- cron: '0 11 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish-check:
10+
name: Check package publishing
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Flutter
18+
uses: subosito/flutter-action@v2
19+
with:
20+
channel: 'stable'
21+
22+
- name: Install dependencies
23+
run: flutter pub get
24+
25+
- name: Run publish dry run
26+
run: dart pub publish --dry-run
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Weekly Security Check
2+
3+
on:
4+
schedule:
5+
- cron: '0 13 * * 1'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
security:
13+
name: Check dependencies
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Flutter
21+
uses: subosito/flutter-action@v2
22+
with:
23+
channel: 'stable'
24+
25+
- name: Install dependencies
26+
run: flutter pub get
27+
28+
- name: Check dependency versions
29+
run: flutter pub outdated

.github/workflows/weekly-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Weekly Tests
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
name: Run package tests
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Flutter
18+
uses: subosito/flutter-action@v2
19+
with:
20+
channel: 'stable'
21+
22+
- name: Install dependencies
23+
run: flutter pub get
24+
25+
- name: Run tests
26+
run: flutter test

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2.5.0
2+
3+
* Added `themeMode` to `SmartCalendar` — light/dark/system
4+
* Added `cellBuilder` to `SmartCalendar` — custom cell widget
5+
* Added `isDark` support to all calendar views
6+
* pub.dev score improvements — more dartdoc examples
7+
18
## 2.4.0
29

310
* Added `showWeekNumbers` to `SmartCalendar`

example/lib/tabs/calendar_widget_tab.dart

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class _CalendarWidgetTabState extends State<CalendarWidgetTab> {
1919
final CalendarView _currentView = CalendarView.month;
2020

2121
bool _showWeekNumbers = false;
22+
// Custom cell builder toggle
23+
bool _useCustomCell = false;
2224

2325
Widget _weekNumbersDemo() => Card(
2426
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
@@ -62,6 +64,116 @@ class _CalendarWidgetTabState extends State<CalendarWidgetTab> {
6264
),
6365
);
6466

67+
Widget _customCellDemo() => Card(
68+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
69+
child: Padding(
70+
padding: const EdgeInsets.all(14),
71+
child: Column(
72+
crossAxisAlignment: CrossAxisAlignment.start,
73+
children: [
74+
Row(
75+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
76+
children: [
77+
const Text(
78+
'🆕 Custom Cell Builder',
79+
style: TextStyle(
80+
fontWeight: FontWeight.bold,
81+
fontSize: 14,
82+
color: Colors.indigo),
83+
),
84+
Switch(
85+
value: _useCustomCell,
86+
onChanged: (val) => setState(() => _useCustomCell = val),
87+
activeThumbColor: Colors.indigo,
88+
),
89+
],
90+
),
91+
const CodeBox(
92+
'SmartCalendar(\n'
93+
' cellBuilder: (date, events, isSelected, isToday) {\n'
94+
' return Container(\n'
95+
' decoration: BoxDecoration(\n'
96+
' color: isSelected ? Colors.indigo : null,\n'
97+
' shape: BoxShape.circle,\n'
98+
' ),\n'
99+
' child: Column(children: [\n'
100+
' Text(\'${'date.day'}\'),\n'
101+
' if (events.isNotEmpty)\n'
102+
' Icon(Icons.circle, size: 6),\n'
103+
' ]),\n'
104+
' );\n'
105+
' },\n'
106+
')',
107+
),
108+
const SizedBox(height: 12),
109+
SmartCalendar(
110+
events: _events,
111+
showViewSwitcher: false,
112+
showTodayButton: false,
113+
markerStyle: _markerStyle,
114+
cellBuilder: _useCustomCell
115+
? (date, events, isSelected, isToday) =>
116+
_customCell(date, events, isSelected, isToday)
117+
: null,
118+
),
119+
],
120+
),
121+
),
122+
);
123+
124+
Widget _customCell(
125+
DateTime date,
126+
List<CalendarEvent> events,
127+
bool isSelected,
128+
bool isToday,
129+
) =>
130+
Container(
131+
margin: const EdgeInsets.all(3),
132+
decoration: BoxDecoration(
133+
color: isSelected
134+
? Colors.indigo
135+
: isToday
136+
? Colors.indigo.withValues(alpha: 0.15)
137+
: events.isNotEmpty
138+
? events.first.color.withValues(alpha: 0.1)
139+
: null,
140+
shape: BoxShape.circle,
141+
border: isToday && !isSelected
142+
? Border.all(color: Colors.indigo, width: 1.5)
143+
: null,
144+
),
145+
child: Column(
146+
mainAxisAlignment: MainAxisAlignment.center,
147+
children: [
148+
Text(
149+
'${date.day}',
150+
style: TextStyle(
151+
fontSize: 13,
152+
fontWeight:
153+
isSelected || isToday ? FontWeight.bold : FontWeight.normal,
154+
color: isSelected ? Colors.white : Colors.black87,
155+
),
156+
),
157+
if (events.isNotEmpty)
158+
Row(
159+
mainAxisAlignment: MainAxisAlignment.center,
160+
children: events
161+
.take(2)
162+
.map((e) => Container(
163+
width: 4,
164+
height: 4,
165+
margin: const EdgeInsets.symmetric(horizontal: 1),
166+
decoration: BoxDecoration(
167+
color: isSelected ? Colors.white : e.color,
168+
shape: BoxShape.circle,
169+
),
170+
))
171+
.toList(),
172+
),
173+
],
174+
),
175+
);
176+
65177
final List<CalendarEvent> _events = [
66178
// Single day events
67179
CalendarEvent(
@@ -215,6 +327,9 @@ class _CalendarWidgetTabState extends State<CalendarWidgetTab> {
215327
_controllerDemo(),
216328
const SizedBox(height: 16),
217329
_weekNumbersDemo(),
330+
const SizedBox(height: 16),
331+
_customCellDemo(),
332+
218333
const SizedBox(height: 16),
219334

220335
// Event properties

example/pubspec.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ packages:
2121
dependency: transitive
2222
description:
2323
name: characters
24-
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
24+
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
2525
url: "https://pub.dev"
2626
source: hosted
27-
version: "1.4.0"
27+
version: "1.4.1"
2828
clock:
2929
dependency: transitive
3030
description:
@@ -111,26 +111,26 @@ packages:
111111
dependency: transitive
112112
description:
113113
name: matcher
114-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
114+
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
115115
url: "https://pub.dev"
116116
source: hosted
117-
version: "0.12.17"
117+
version: "0.12.19"
118118
material_color_utilities:
119119
dependency: transitive
120120
description:
121121
name: material_color_utilities
122-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
122+
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
123123
url: "https://pub.dev"
124124
source: hosted
125-
version: "0.11.1"
125+
version: "0.13.0"
126126
meta:
127127
dependency: transitive
128128
description:
129129
name: meta
130-
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
130+
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
131131
url: "https://pub.dev"
132132
source: hosted
133-
version: "1.16.0"
133+
version: "1.18.0"
134134
path:
135135
dependency: transitive
136136
description:
@@ -211,10 +211,10 @@ packages:
211211
dependency: transitive
212212
description:
213213
name: test_api
214-
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
214+
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
215215
url: "https://pub.dev"
216216
source: hosted
217-
version: "0.7.6"
217+
version: "0.7.11"
218218
vector_math:
219219
dependency: transitive
220220
description:
@@ -248,5 +248,5 @@ packages:
248248
source: hosted
249249
version: "3.1.3"
250250
sdks:
251-
dart: ">=3.9.0 <4.0.0"
251+
dart: ">=3.10.0-0 <4.0.0"
252252
flutter: ">=3.18.0-18.0.pre.54"

0 commit comments

Comments
 (0)