@@ -121,6 +121,9 @@ class MessagesPageState extends State<MessagesPage> with TickerProviderStateMixi
121
121
.first
122
122
.then ((response) {
123
123
_settings = response.data;
124
+ _settings! .folders.sort (
125
+ (a, b) => a.position.compareTo (b.position),
126
+ );
124
127
_folder = _settings! .folders.firstWhere ((element) => element.folderType == FolderType .INBOX );
125
128
setState (() {});
126
129
load ();
@@ -230,7 +233,7 @@ class MessagesPageState extends State<MessagesPage> with TickerProviderStateMixi
230
233
innerBoxIsScrolled ? 12 : 2 ,
231
234
),
232
235
),
233
- child: DropdownButton <Folder >(
236
+ child: DropdownButton <String >(
234
237
borderRadius: BorderRadius .circular (16 ),
235
238
dropdownColor: ElevationOverlay .applySurfaceTint (
236
239
Theme .of (context).colorScheme.surface,
@@ -239,7 +242,11 @@ class MessagesPageState extends State<MessagesPage> with TickerProviderStateMixi
239
242
),
240
243
isExpanded: true ,
241
244
underline: Container (),
242
- items: _settings? .folders.map <DropdownMenuItem <Folder >>(
245
+ items: _settings? .folders
246
+ .where ((folder) =>
247
+ folder.folderType != FolderType .DRAFTS &&
248
+ folder.folderType != FolderType .MODERATION )
249
+ .map <DropdownMenuItem <String >>(
243
250
(folder) {
244
251
final IconData icon;
245
252
if (folder.folderType == FolderType .INBOX ) {
@@ -257,7 +264,7 @@ class MessagesPageState extends State<MessagesPage> with TickerProviderStateMixi
257
264
icon = Icons .folder;
258
265
}
259
266
return DropdownMenuItem (
260
- value: folder,
267
+ value: folder.id ,
261
268
child: Row (
262
269
children: [
263
270
Padding (
@@ -276,15 +283,34 @@ class MessagesPageState extends State<MessagesPage> with TickerProviderStateMixi
276
283
);
277
284
},
278
285
).toList () ??
279
- [],
286
+ [
287
+ const DropdownMenuItem (
288
+ child: Row (
289
+ children: [
290
+ Padding (
291
+ padding: EdgeInsets .all (8.0 ),
292
+ child: Icon (Icons .inbox),
293
+ ),
294
+ Flexible (
295
+ child: Text (
296
+ 'Chargement...' ,
297
+ overflow: TextOverflow .fade,
298
+ softWrap: false ,
299
+ ),
300
+ ),
301
+ ],
302
+ ),
303
+ )
304
+ ],
280
305
onChanged: (folder) {
281
- _folder = folder;
306
+ _folder = _settings? .folders
307
+ .firstWhere ((element) => element.id == folder);
282
308
_loaded = false ;
283
309
_communications = [];
284
310
setState (() {});
285
311
load ();
286
312
},
287
- value: _folder,
313
+ value: _folder? .id ,
288
314
),
289
315
),
290
316
floating: false ,
0 commit comments