Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion frontend/ongi/lib/screens/bottom_nav.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _BottomNavScreenState extends State<BottomNavScreen> {
final List<Widget> _screens = [
HomeScreen(key: homeScreenKey),
HealthHomeScreen(key: healthHomeScreenKey),
const PhotoCalendarScreen(),
PhotoCalendarScreen(key: photoCalendarScreenKey),
const ProfileScreen(),
];

Expand Down Expand Up @@ -125,6 +125,20 @@ class _BottomNavScreenState extends State<BottomNavScreen> {
}
}

Future<void> _refreshPhotoData() async {
// 마음기록(앨범) 화면의 데이터를 백그라운드에서 새로고침
try {
final photoCalendarScreenState = photoCalendarScreenKey.currentState;
if (photoCalendarScreenState != null) {
// 백그라운드에서 조용히 새로고침 수행
await photoCalendarScreenState.refreshPhotoCalendar();
}
} catch (e) {
// 새로고침 실패 시 조용히 처리
print('마음기록 데이터 새로고침 실패 (조용히 처리됨): $e');
}
}

void _onTabTapped(int index) {
setState(() {
_currentIndex = index;
Expand All @@ -143,6 +157,11 @@ class _BottomNavScreenState extends State<BottomNavScreen> {
if (index == 1) {
_refreshHealthData();
}

// 마음기록(앨범) 탭(index=2) 선택 시 백그라운드 새로고침
if (index == 2) {
_refreshPhotoData();
}
}

Future<void> _onAddRecordTapped() async {
Expand Down
2 changes: 1 addition & 1 deletion frontend/ongi/lib/screens/home/home_degree_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class _HomeDegreeGraph extends State<HomeDegreeGraph> {
),
),
Text(
item.formattedDate ?? '',
item.formattedDate,
style: const TextStyle(
color: Colors.grey,
fontSize: 12,
Expand Down
2 changes: 0 additions & 2 deletions frontend/ongi/lib/screens/photo/check_record_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import 'package:geolocator/geolocator.dart';
import 'package:geocoding/geocoding.dart';
import 'package:ongi/screens/photo/detail_record_screen.dart';

import '../home/home_screen.dart';

class CheckRecordScreen extends StatefulWidget {
final String backImagePath;
final String? frontImagePath;
Expand Down
20 changes: 19 additions & 1 deletion frontend/ongi/lib/screens/photo/photo_calendar_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class PhotoCalendarScreen extends StatefulWidget {
State<PhotoCalendarScreen> createState() => _PhotoCalendarScreenState();
}

// 전역 키를 사용해서 외부에서 새로고침 메서드에 접근할 수 있도록 함
final GlobalKey<_PhotoCalendarScreenState> photoCalendarScreenKey = GlobalKey<_PhotoCalendarScreenState>();

class _PhotoCalendarScreenState extends State<PhotoCalendarScreen> {
String _currentView = 'calendar';
DateTime _focusedDay = DateTime.now();
Expand All @@ -31,7 +34,22 @@ class _PhotoCalendarScreenState extends State<PhotoCalendarScreen> {
_fetchCalendarDataForMonth(_focusedDay);
}

void _goBackToCalendar() => setState(() => _currentView = 'calendar');
// 외부에서 호출 가능한 새로고침 메서드
Future<void> refreshPhotoCalendar() async {
try {
await _fetchCalendarDataForMonth(_focusedDay);
} catch (e) {
print('마음기록 캘린더 새로고침 실패: $e');
}
}

void _goBackToCalendar() {
setState(() => _currentView = 'calendar');
// 캘린더로 복귀 시 자동 새로고침
WidgetsBinding.instance.addPostFrameCallback((_) {
refreshPhotoCalendar();
});
}

Widget _dayCellBuilder(
BuildContext context,
Expand Down
1 change: 0 additions & 1 deletion frontend/ongi/lib/services/pain_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart' as http;
import '../utils/prefs_manager.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';

class TemperatureSummaryService {
// API URL
Expand Down
Loading