2026-09-21 04:09:35 +00:00
|
|
|
// 👥 백품타 그룹 상세 화면 (UI 전용) - 멤버 오늘 출석 현황, 친구 초대, 그룹 나가기.
|
|
|
|
|
// 서버 통신/상태는 lib/function/group_detail_controller.dart, friend_controller.dart가 담당한다.
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import '../function/friend_controller.dart';
|
|
|
|
|
import '../function/group_detail_controller.dart';
|
|
|
|
|
import '../theme/app_palette.dart';
|
2026-10-01 07:17:11 +00:00
|
|
|
import '../theme/theme_sync.dart';
|
2026-09-21 04:09:35 +00:00
|
|
|
import 'app_notice.dart';
|
2026-09-22 03:58:21 +00:00
|
|
|
import 'launchpad_transition.dart';
|
|
|
|
|
import 'study_timer_screen.dart';
|
2026-09-21 04:09:35 +00:00
|
|
|
import 'title_pill.dart';
|
|
|
|
|
|
|
|
|
|
class GroupDetailScreen extends StatefulWidget {
|
|
|
|
|
final int groupId;
|
|
|
|
|
final String groupName;
|
|
|
|
|
final String studentId;
|
2026-09-22 03:58:21 +00:00
|
|
|
final String studentName;
|
|
|
|
|
final int? grade;
|
2026-09-21 04:09:35 +00:00
|
|
|
|
|
|
|
|
const GroupDetailScreen({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.groupId,
|
|
|
|
|
required this.groupName,
|
|
|
|
|
required this.studentId,
|
2026-09-22 03:58:21 +00:00
|
|
|
required this.studentName,
|
|
|
|
|
this.grade,
|
2026-09-21 04:09:35 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<GroupDetailScreen> createState() => _GroupDetailScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _GroupDetailScreenState extends State<GroupDetailScreen> {
|
|
|
|
|
late final GroupDetailController _controller;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_controller = GroupDetailController(
|
|
|
|
|
groupId: widget.groupId,
|
|
|
|
|
studentId: widget.studentId,
|
|
|
|
|
);
|
|
|
|
|
_controller.init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_controller.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _showInviteSheet() async {
|
|
|
|
|
final friendController = FriendController(
|
|
|
|
|
studentId: widget.studentId,
|
|
|
|
|
studentName: '',
|
|
|
|
|
);
|
|
|
|
|
await friendController.init();
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
|
|
|
|
|
final memberIds = _controller.members
|
|
|
|
|
.map((m) => m['studentId'] as String)
|
|
|
|
|
.toSet();
|
|
|
|
|
final invitable = friendController.friends
|
|
|
|
|
.where((f) => !memberIds.contains(f['studentId']))
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
await showModalBottomSheet<void>(
|
|
|
|
|
context: context,
|
|
|
|
|
backgroundColor: AppPalette.paper,
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
|
|
|
|
),
|
|
|
|
|
builder: (sheetContext) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const Text(
|
|
|
|
|
'친구 초대',
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
if (invitable.isEmpty)
|
|
|
|
|
const Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16),
|
|
|
|
|
child: Text(
|
|
|
|
|
'초대할 수 있는 친구가 없어요.\n(이미 그룹에 있거나 친구가 없어요)',
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
ConstrainedBox(
|
|
|
|
|
constraints: const BoxConstraints(maxHeight: 320),
|
|
|
|
|
child: ListView(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
children: [
|
|
|
|
|
for (final f in invitable)
|
|
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(
|
|
|
|
|
Icons.person_rounded,
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
),
|
|
|
|
|
title: Text('${f['name']}'),
|
|
|
|
|
subtitle: Text('${f['studentId']}'),
|
|
|
|
|
trailing: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
2026-10-01 07:17:11 +00:00
|
|
|
backgroundColor:
|
|
|
|
|
globalProfileTheme.value?.accent ??
|
|
|
|
|
AppPalette.ink,
|
2026-09-21 04:09:35 +00:00
|
|
|
foregroundColor: AppPalette.paper,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
final (success, message) = await _controller
|
|
|
|
|
.invite(
|
|
|
|
|
f['studentId'] as String,
|
|
|
|
|
f['name'] as String,
|
|
|
|
|
);
|
|
|
|
|
if (sheetContext.mounted) {
|
|
|
|
|
Navigator.of(sheetContext).pop();
|
|
|
|
|
}
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
AppNotice.show(
|
|
|
|
|
context,
|
|
|
|
|
message,
|
|
|
|
|
icon: success
|
|
|
|
|
? Icons.check_circle_rounded
|
|
|
|
|
: Icons.error_outline_rounded,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: const Text('초대'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
friendController.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-22 03:49:35 +00:00
|
|
|
Future<void> _toggleVisibility() async {
|
|
|
|
|
final makePublic = !_controller.isPublic;
|
|
|
|
|
final confirmed = await showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (dialogContext) => AlertDialog(
|
|
|
|
|
title: Text(makePublic ? '공개 그룹으로 전환' : '비공개 그룹으로 전환'),
|
|
|
|
|
content: Text(
|
|
|
|
|
makePublic
|
|
|
|
|
? '이제 누구나 이 그룹을 찾아서 참여 신청을 보낼 수 있어요. 참여는 그룹장이 허용해야 완료됩니다.'
|
|
|
|
|
: '더 이상 공개 목록에 뜨지 않고, 대기 중인 참여 신청은 모두 거절 처리됩니다.',
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => Navigator.pop(dialogContext, false),
|
|
|
|
|
child: const Text('취소', style: TextStyle(color: Colors.grey)),
|
|
|
|
|
),
|
|
|
|
|
ElevatedButton(
|
2026-10-01 05:52:57 +00:00
|
|
|
autofocus: true,
|
2026-09-22 03:49:35 +00:00
|
|
|
style: ElevatedButton.styleFrom(
|
2026-10-01 07:17:11 +00:00
|
|
|
backgroundColor:
|
|
|
|
|
globalProfileTheme.value?.accent ?? AppPalette.ink,
|
2026-09-22 03:49:35 +00:00
|
|
|
foregroundColor: AppPalette.paper,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => Navigator.pop(dialogContext, true),
|
|
|
|
|
child: const Text('전환'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (confirmed != true) return;
|
|
|
|
|
final (_, message) = await _controller.setVisibility(makePublic);
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
AppNotice.show(context, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _respondJoinRequest(int requestId, bool accept) async {
|
|
|
|
|
final (_, message) = await _controller.respondJoinRequest(
|
|
|
|
|
requestId,
|
|
|
|
|
accept,
|
|
|
|
|
);
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
AppNotice.show(context, message);
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-21 04:09:35 +00:00
|
|
|
Future<void> _leave() async {
|
|
|
|
|
final confirmed = await showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (dialogContext) => AlertDialog(
|
|
|
|
|
title: const Text('그룹 나가기'),
|
|
|
|
|
content: Text('${widget.groupName} 그룹에서 나가시겠습니까?'),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => Navigator.pop(dialogContext, false),
|
|
|
|
|
child: const Text('취소', style: TextStyle(color: Colors.grey)),
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
2026-10-01 05:52:57 +00:00
|
|
|
autofocus: true,
|
2026-09-21 04:09:35 +00:00
|
|
|
onPressed: () => Navigator.pop(dialogContext, true),
|
2026-09-30 06:29:37 +00:00
|
|
|
child: const Text(
|
|
|
|
|
'나가기',
|
|
|
|
|
style: TextStyle(color: AppPalette.danger),
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (confirmed != true) return;
|
|
|
|
|
final (success, message) = await _controller.leave();
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
AppNotice.show(context, message);
|
|
|
|
|
if (success) Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String _formatMinutes(int seconds) {
|
2026-09-29 06:40:15 +00:00
|
|
|
final h = seconds ~/ 3600;
|
|
|
|
|
final m = (seconds % 3600) ~/ 60;
|
|
|
|
|
final s = seconds % 60;
|
|
|
|
|
if (h > 0) return '$h시간 $m분';
|
|
|
|
|
if (m > 0) return '$m분 $s초';
|
|
|
|
|
return '$s초';
|
2026-09-21 04:09:35 +00:00
|
|
|
}
|
|
|
|
|
|
2026-09-30 05:12:55 +00:00
|
|
|
/// 🎨 오늘 공부 시간 30분 단위로 프로필 테두리 색이 흰→노랑→주황→빨강→보라로
|
|
|
|
|
/// 진해진다. 2시간(4단계) 넘으면 보라색에서 멈춘다.
|
|
|
|
|
static const List<Color> _studyFrameColors = [
|
|
|
|
|
Color(0xFFE0E0E0), // 흰(기본)
|
|
|
|
|
Color(0xFFFFC107), // 노랑
|
|
|
|
|
Color(0xFFFF9800), // 주황
|
|
|
|
|
Color(0xFFE53935), // 빨강
|
|
|
|
|
Color(0xFF8E24AA), // 보라
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
Color _studyFrameColor(int todaySeconds) {
|
|
|
|
|
final tier = (todaySeconds ~/ 1800).clamp(0, _studyFrameColors.length - 1);
|
|
|
|
|
return _studyFrameColors[tier];
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-22 03:58:21 +00:00
|
|
|
void _openTimer() {
|
|
|
|
|
pushLaunchpad(
|
|
|
|
|
context,
|
|
|
|
|
(context) => StudyTimerScreen(
|
|
|
|
|
studentId: widget.studentId,
|
|
|
|
|
studentName: widget.studentName,
|
|
|
|
|
grade: widget.grade,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 넓은 화면(웹 데스크톱)에서 내용이 양옆으로 늘어지지 않게 가운데 최대 560 폭으로 맞춘다.
|
|
|
|
|
double _sidePad(BuildContext context) {
|
|
|
|
|
final width = MediaQuery.of(context).size.width;
|
|
|
|
|
return ((width - 560) / 2).clamp(16.0, double.infinity);
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-21 04:09:35 +00:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return ListenableBuilder(
|
|
|
|
|
listenable: _controller,
|
|
|
|
|
builder: (context, _) {
|
|
|
|
|
final members = _controller.members;
|
|
|
|
|
final attendedCount = members
|
|
|
|
|
.where((m) => m['attendedToday'] == true)
|
|
|
|
|
.length;
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppPalette.mist,
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
foregroundColor: AppPalette.ink,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
actions: [
|
2026-09-22 03:49:35 +00:00
|
|
|
if (_controller.isOwner)
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
_controller.isPublic
|
|
|
|
|
? Icons.public_rounded
|
|
|
|
|
: Icons.lock_rounded,
|
|
|
|
|
),
|
|
|
|
|
tooltip: _controller.isPublic ? '공개 그룹' : '비공개 그룹',
|
|
|
|
|
onPressed: _toggleVisibility,
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.exit_to_app_rounded),
|
|
|
|
|
tooltip: '그룹 나가기',
|
|
|
|
|
onPressed: _leave,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: FloatingActionButton.extended(
|
2026-10-01 07:17:11 +00:00
|
|
|
backgroundColor: globalProfileTheme.value?.accent ?? AppPalette.ink,
|
2026-09-21 04:09:35 +00:00
|
|
|
foregroundColor: AppPalette.paper,
|
|
|
|
|
onPressed: _showInviteSheet,
|
|
|
|
|
icon: const Icon(Icons.person_add_rounded),
|
|
|
|
|
label: const Text('친구 초대'),
|
|
|
|
|
),
|
|
|
|
|
body: _controller.isLoading
|
|
|
|
|
? const Center(child: CircularProgressIndicator())
|
|
|
|
|
: RefreshIndicator(
|
|
|
|
|
onRefresh: _controller.refresh,
|
|
|
|
|
child: ListView(
|
2026-09-22 03:58:21 +00:00
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
|
_sidePad(context),
|
|
|
|
|
0,
|
|
|
|
|
_sidePad(context),
|
|
|
|
|
90,
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
children: [
|
|
|
|
|
Center(child: TitlePill(widget.groupName)),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: _statPill('전체 멤버', members.length)),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
Expanded(child: _statPill('오늘 공부함', attendedCount)),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-09-22 03:58:21 +00:00
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: OutlinedButton.icon(
|
|
|
|
|
onPressed: _openTimer,
|
|
|
|
|
icon: const Icon(Icons.timer_rounded),
|
|
|
|
|
label: const Text('백품타 바로가기'),
|
|
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
|
foregroundColor: AppPalette.ink,
|
2026-10-01 07:09:06 +00:00
|
|
|
side: BorderSide(color: AppPalette.sage),
|
2026-09-22 03:58:21 +00:00
|
|
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-09-22 03:49:35 +00:00
|
|
|
if (_controller.isOwner &&
|
|
|
|
|
_controller.joinRequests.isNotEmpty) ...[
|
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 4,
|
|
|
|
|
height: 16,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
const Text(
|
|
|
|
|
'대기 중인 참여 신청',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 6),
|
|
|
|
|
Text(
|
|
|
|
|
'${_controller.joinRequests.length}명',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
color: Colors.grey[500],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
for (final r in _controller.joinRequests)
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(bottom: 8),
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 16,
|
|
|
|
|
vertical: 12,
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppPalette.paper,
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
border: Border.all(color: AppPalette.sage),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
'${r['name']} (${r['studentId']})',
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => _respondJoinRequest(
|
|
|
|
|
r['requestId'] as int,
|
|
|
|
|
false,
|
|
|
|
|
),
|
|
|
|
|
child: const Text(
|
|
|
|
|
'거절',
|
|
|
|
|
style: TextStyle(color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
2026-10-01 07:17:11 +00:00
|
|
|
backgroundColor:
|
|
|
|
|
globalProfileTheme.value?.accent ??
|
|
|
|
|
AppPalette.ink,
|
2026-09-22 03:49:35 +00:00
|
|
|
foregroundColor: AppPalette.paper,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => _respondJoinRequest(
|
|
|
|
|
r['requestId'] as int,
|
|
|
|
|
true,
|
|
|
|
|
),
|
|
|
|
|
child: const Text('허용'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
2026-09-21 04:09:35 +00:00
|
|
|
const SizedBox(height: 20),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 4,
|
|
|
|
|
height: 16,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
const Text(
|
|
|
|
|
'오늘 출석 현황',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-09-29 06:40:15 +00:00
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
Text(
|
|
|
|
|
'1시간 이상 공부해야 출석으로 표시돼요.',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11.5,
|
|
|
|
|
color: Colors.grey[500],
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-09-30 05:12:55 +00:00
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'프로필 테두리는 30분마다 색이 진해져요',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11.5,
|
|
|
|
|
color: Colors.grey[500],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 6),
|
|
|
|
|
for (final c in _studyFrameColors)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 2),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 10,
|
|
|
|
|
height: 10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
color: c,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
const SizedBox(height: 10),
|
2026-09-22 03:58:21 +00:00
|
|
|
GridView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
gridDelegate:
|
|
|
|
|
const SliverGridDelegateWithMaxCrossAxisExtent(
|
|
|
|
|
maxCrossAxisExtent: 150,
|
|
|
|
|
mainAxisSpacing: 10,
|
|
|
|
|
crossAxisSpacing: 10,
|
|
|
|
|
mainAxisExtent: 96,
|
|
|
|
|
),
|
|
|
|
|
itemCount: members.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
final m = members[index];
|
|
|
|
|
final attended = m['attendedToday'] == true;
|
2026-09-30 05:12:55 +00:00
|
|
|
final todaySeconds =
|
|
|
|
|
(m['todaySeconds'] as num?)?.toInt() ?? 0;
|
2026-09-22 03:58:21 +00:00
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: attended
|
|
|
|
|
? AppPalette.ink
|
|
|
|
|
: AppPalette.paper,
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: attended
|
2026-09-21 04:09:35 +00:00
|
|
|
? AppPalette.ink
|
2026-09-22 03:58:21 +00:00
|
|
|
: AppPalette.sage,
|
2026-09-21 04:09:35 +00:00
|
|
|
),
|
2026-09-22 03:58:21 +00:00
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
2026-09-30 05:12:55 +00:00
|
|
|
Container(
|
|
|
|
|
width: 30,
|
|
|
|
|
height: 30,
|
|
|
|
|
padding: const EdgeInsets.all(2.5),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: _studyFrameColor(todaySeconds),
|
|
|
|
|
width: 3,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
backgroundColor: attended
|
|
|
|
|
? Colors.white24
|
|
|
|
|
: AppPalette.linen,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.person_rounded,
|
|
|
|
|
size: 13,
|
|
|
|
|
color: attended
|
|
|
|
|
? Colors.white
|
|
|
|
|
: AppPalette.ink,
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-09-22 03:58:21 +00:00
|
|
|
),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
Text(
|
|
|
|
|
'${m['name']}',
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
2026-09-21 04:09:35 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
2026-09-22 03:58:21 +00:00
|
|
|
fontSize: 13,
|
|
|
|
|
color: attended
|
|
|
|
|
? Colors.white
|
|
|
|
|
: AppPalette.ink,
|
2026-09-21 04:09:35 +00:00
|
|
|
),
|
|
|
|
|
),
|
2026-09-22 03:58:21 +00:00
|
|
|
if (m['role'] == 'owner')
|
|
|
|
|
Text(
|
|
|
|
|
'그룹장',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
color: attended
|
|
|
|
|
? Colors.white70
|
|
|
|
|
: Colors.grey[500],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
|
Text(
|
2026-09-30 05:12:55 +00:00
|
|
|
_formatMinutes(todaySeconds),
|
2026-09-22 03:58:21 +00:00
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
color: attended
|
|
|
|
|
? Colors.white70
|
|
|
|
|
: Colors.grey[500],
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
),
|
2026-09-22 03:58:21 +00:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-09-21 04:09:35 +00:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _statPill(String label, int count) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppPalette.paper,
|
|
|
|
|
borderRadius: BorderRadius.circular(28),
|
|
|
|
|
border: Border.all(color: AppPalette.sage),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Text(label, style: TextStyle(fontSize: 12, color: Colors.grey[600])),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
Text(
|
|
|
|
|
'$count명',
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: AppPalette.ink,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|