새로고침 버튼에 로딩 표시 추가
버튼을 눌러도 아무 반응이 없어 보인다는 피드백 반영 - 클릭 시 아이콘이 잠깐 스피너로 바뀌도록 해서 실제로 새로고침이 진행 중임을 알 수 있게 함. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
|
||||
Map<String, dynamic> _activeViolationsByStudentId = {}; // 무단반출 중인 학생 (/api/violations/active)
|
||||
Timer? _timer;
|
||||
bool _isLoading = true;
|
||||
bool _isRefreshing = false; // 새로고침 버튼 클릭 시 잠깐 도는 표시용
|
||||
String _filterType = "ALL"; // "ALL", "CHECKED_IN", "ABSENT"
|
||||
|
||||
@override
|
||||
@@ -41,6 +42,12 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _manualRefresh() async {
|
||||
setState(() => _isRefreshing = true);
|
||||
await _fetchAll();
|
||||
if (mounted) setState(() => _isRefreshing = false);
|
||||
}
|
||||
|
||||
Future<void> _fetchAll() async {
|
||||
try {
|
||||
final results = await Future.wait([
|
||||
@@ -275,8 +282,17 @@ class _TeacherAttendancePageState extends State<TeacherAttendancePage> {
|
||||
elevation: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: _isLoading ? null : _fetchAll,
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: (_isLoading || _isRefreshing) ? null : _manualRefresh,
|
||||
icon: _isRefreshing
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.refresh_rounded),
|
||||
tooltip: '새로고침',
|
||||
),
|
||||
TextButton.icon(
|
||||
|
||||
Reference in New Issue
Block a user