@@ -42,14 +42,19 @@ class _CalendarState extends State<Calendar> with MyHomePageStateMixin {
42
42
Timestamp firebaseDate = postData["date" ];
43
43
DateTime postDate = DateTime .parse (firebaseDate.toDate ().toString ());
44
44
Post newPostObj = Post (
45
- title: postData["title" ],
46
- content: postData["content" ],
47
- date: postDate,
48
- people: postData["people" ],
49
- photos: postData["photos" ]);
45
+ title: postData["title" ],
46
+ content: postData["content" ],
47
+ date: postDate,
48
+ people: postData["people" ],
49
+ photos: postData["photos" ],
50
+ id: element.id,
51
+ );
50
52
setState (() {
51
53
if (kEvents.containsKey (postDate)) {
52
- kEvents[postDate]! .add (newPostObj);
54
+ if (! kEvents[postDate]!
55
+ .any ((element) => newPostObj.isSameId (element))) {
56
+ kEvents[postDate]! .add (newPostObj);
57
+ }
53
58
} else {
54
59
kEvents[postDate] = [newPostObj];
55
60
}
@@ -135,9 +140,18 @@ class _CalendarState extends State<Calendar> with MyHomePageStateMixin {
135
140
rangeSelectionMode: _rangeSelectionMode,
136
141
eventLoader: _getEventsForDay,
137
142
startingDayOfWeek: StartingDayOfWeek .monday,
138
- calendarStyle: const CalendarStyle (
143
+ calendarStyle: CalendarStyle (
139
144
// Use `CalendarStyle` to customize the UI
140
145
outsideDaysVisible: false ,
146
+ selectedDecoration: BoxDecoration (
147
+ color: darkBackgroundColor,
148
+ shape: BoxShape .circle,
149
+ ),
150
+ // today 모양 조정
151
+ todayDecoration: BoxDecoration (
152
+ color: darkBackgroundColor.withOpacity (0.7 ),
153
+ shape: BoxShape .circle,
154
+ ),
141
155
),
142
156
onDaySelected: _onDaySelected,
143
157
onRangeSelected: _onRangeSelected,
@@ -151,18 +165,20 @@ class _CalendarState extends State<Calendar> with MyHomePageStateMixin {
151
165
onPageChanged: (focusedDay) {
152
166
_focusedDay = focusedDay;
153
167
},
154
- calendarBuilders:
155
- CalendarBuilders ( markerBuilder: (context, date, dynamic event) {
156
- if (event.isNotEmpty) {
157
- return Container (
158
- width: 35 ,
159
- decoration: BoxDecoration (
168
+ calendarBuilders: CalendarBuilders (
169
+ markerBuilder: (context, date, dynamic event) {
170
+ if (event.isNotEmpty) {
171
+ return Container (
172
+ width: 35 ,
173
+ decoration: BoxDecoration (
160
174
color: pointColor.withOpacity (0.2 ),
161
- shape: BoxShape .circle),
162
- );
163
- }
164
- return null ;
165
- }),
175
+ shape: BoxShape .circle,
176
+ ),
177
+ );
178
+ }
179
+ return null ;
180
+ },
181
+ ),
166
182
),
167
183
const SizedBox (height: 8.0 ),
168
184
Expanded (
0 commit comments