import 'package:intl/intl.dart'; import 'package:get/get.dart'; import '../people_photo/photo_group.dart'; class CalendarState { static final RxList monthlyAlbums = [].obs; // 格式化月份 static String formatMonth(String month) { try { DateTime date = DateFormat('yyyy-MM').parse(month); return DateFormat('MMM , yyyy').format(date); // 转换为 "Nov, 2024" 格式 } catch (e) { return month; // 如果解析失败,返回原始字符串 } } static void removePhotosData(Set selectedPhotosIds) { monthlyAlbums.removeWhere((album) { album.images .removeWhere((element) => selectedPhotosIds.contains(element.id)); album.selectedPhotosIds .removeWhere((element) => selectedPhotosIds.contains(element)); // 如果images为空,删除该 album return album.images.isEmpty; }); } }