130 lines
4.0 KiB
Dart
130 lines
4.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../core/i18n/app_locale.dart';
|
|
import '../../core/theme/tokens.dart';
|
|
import 'my_data.dart';
|
|
import 'widgets/my_cards.dart';
|
|
|
|
/// 「2026.04.30」 — 시안 공지 날짜 표기.
|
|
String _date(DateTime at) =>
|
|
'${at.year}.${at.month.toString().padLeft(2, '0')}.${at.day.toString().padLeft(2, '0')}';
|
|
|
|
/// 머리 세 줄 — 「공지」 13/500 분홍 · 제목 15/600 · 날짜 12/600 #777(간격 8 · 12).
|
|
class _NoticeHead extends StatelessWidget {
|
|
const _NoticeHead({required this.notice});
|
|
|
|
final NoticeItem notice;
|
|
|
|
static TextStyle _s(double size, FontWeight w, Color c) => TextStyle(
|
|
fontFamily: AppFonts.body,
|
|
fontSize: size,
|
|
fontWeight: w,
|
|
height: 1,
|
|
color: c,
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
context.l10n.noticeBadge,
|
|
style: _s(13, FontWeight.w500, AppColors.cosmicAccent),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(notice.title, style: _s(15, FontWeight.w600, AppColors.onCosmic)),
|
|
const SizedBox(height: 12),
|
|
Text(_date(notice.at), style: _s(12, FontWeight.w600, MyColors.muted)),
|
|
],
|
|
);
|
|
}
|
|
|
|
/// 공지사항 — 화면 대조 원장 F6 · Figma `357:224574`: 카드 #19191c · 모서리 16 · 안쪽 20/16 · 간격 12.
|
|
class NoticeListScreen extends StatefulWidget {
|
|
const NoticeListScreen({super.key, required this.repository});
|
|
|
|
final MyRepository repository;
|
|
|
|
@override
|
|
State<NoticeListScreen> createState() => _NoticeListScreenState();
|
|
}
|
|
|
|
class _NoticeListScreenState extends State<NoticeListScreen> {
|
|
List<NoticeItem>? _notices;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
widget.repository.notices().then((n) {
|
|
if (mounted) setState(() => _notices = n);
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final notices = _notices;
|
|
if (notices == null) {
|
|
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
|
}
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(context.l10n.noticeTitle)),
|
|
body: notices.isEmpty
|
|
? Center(
|
|
child: Text(
|
|
context.l10n.noticeEmpty,
|
|
style: myText(14, FontWeight.w500),
|
|
),
|
|
)
|
|
: ListView.separated(
|
|
padding: const EdgeInsets.all(16),
|
|
itemCount: notices.length,
|
|
separatorBuilder: (_, _) => const SizedBox(height: 12),
|
|
itemBuilder: (context, i) {
|
|
final n = notices[i];
|
|
return GestureDetector(
|
|
onTap: () => Navigator.of(context, rootNavigator: true).push(
|
|
MaterialPageRoute<void>(
|
|
builder: (_) => NoticeDetailScreen(notice: n),
|
|
),
|
|
),
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 16,
|
|
vertical: 20,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: MyColors.card,
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
),
|
|
child: _NoticeHead(notice: n),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 공지사항 상세 — Figma `357:224775`: 머리 · 구분선 #313131 · 본문 14/400 행간 140%.
|
|
class NoticeDetailScreen extends StatelessWidget {
|
|
const NoticeDetailScreen({super.key, required this.notice});
|
|
|
|
final NoticeItem notice;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
appBar: AppBar(title: Text(context.l10n.noticeDetailTitle)),
|
|
body: ListView(
|
|
padding: const EdgeInsets.all(16),
|
|
children: [
|
|
_NoticeHead(notice: notice),
|
|
const SizedBox(height: 12),
|
|
const SizedBox(height: 1, child: ColoredBox(color: Color(0xFF313131))),
|
|
const SizedBox(height: 18),
|
|
Text(notice.body, style: myText(14, FontWeight.w400)),
|
|
],
|
|
),
|
|
);
|
|
}
|