chore: 添加 iOS/Android 相机和相册权限配置

This commit is contained in:
qzl
2026-03-11 17:32:00 +08:00
parent e2eff03060
commit 177ed616bf
5 changed files with 59 additions and 28 deletions
@@ -44,7 +44,6 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
final ScrollController _dayStripController = ScrollController();
Key _eventsKey = UniqueKey();
List<ScheduleItemModel> _events = const [];
String? _lastRoute;
@override
void initState() {
@@ -62,20 +61,17 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
WidgetsBinding.instance.addPostFrameCallback((_) {
_scrollToSelectedDate();
_lastRoute = GoRouterState.of(context).uri.toString();
_setupRouteListener();
});
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
final currentRoute = GoRouterState.of(context).uri.toString();
if (_lastRoute != null && _lastRoute != currentRoute) {
if (!currentRoute.contains('/events/')) {
_loadEvents();
}
}
_lastRoute = currentRoute;
void _setupRouteListener() {
final router = GoRouter.of(context);
router.routerDelegate.addListener(_onRouteChange);
}
void _onRouteChange() {
_loadEvents();
}
void _updateMonthDates() {
@@ -94,6 +90,9 @@ class _CalendarDayWeekScreenState extends State<CalendarDayWeekScreen>
@override
void dispose() {
try {
GoRouter.of(context).routerDelegate.removeListener(_onRouteChange);
} catch (_) {}
WidgetsBinding.instance.removeObserver(this);
_dayStripController.dispose();
super.dispose();