import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; // Import screenutil

class NoticeScreen extends StatelessWidget {
  const NoticeScreen({super.key});

  final List<Map<String, String>> notices = const [
    {
      'title': 'RUP 서비스 런칭 안내',
      'date': '2024.01.20',
      'content': '반려동물 통합 관리 플랫폼 RUP가 정식 런칭되었습니다. 많은 이용 부탁드립니다.',
    },
    {
      'title': '시스템 점검 안내',
      'date': '2024.01.15',
      'content': '더나은 서비스를 위해 시스템 점검이 진행될 예정입니다.\n일시: 2024.01.25 02:00 ~ 04:00',
    },
    {
      'title': '이용약관 개정 안내',
      'date': '2024.01.10',
      'content': '서비스 이용약관이 일부 개정되었습니다. 주요 변경사항을 확인해주세요.',
    },
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: Text(
          '공지사항',
          style: TextStyle(
            fontFamily: 'SCDream',
            fontWeight: FontWeight.bold,
            color: Colors.black,
            fontSize: 18.sp, // Added responsive font size
          ),
        ),
        centerTitle: true,
        backgroundColor: Colors.white,
        elevation: 0,
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios, color: Colors.black, size: 20.w),
          onPressed: () => Navigator.pop(context),
        ),
      ),
      body: ListView.separated(
        itemCount: notices.length,
        separatorBuilder: (context, index) =>
            Divider(height: 1.h, color: const Color(0xFFEEEEEE)),
        itemBuilder: (context, index) {
          final notice = notices[index];
          return ExpansionTile(
            tilePadding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.h),
            title: Text(
              notice['title']!,
              style: TextStyle(
                fontFamily: 'SCDream',
                fontSize: 16.sp,
                fontWeight: FontWeight.w500,
                color: Colors.black87,
              ),
            ),
            subtitle: Padding(
              padding: EdgeInsets.only(top: 4.h),
              child: Text(
                notice['date']!,
                style: TextStyle(
                  fontFamily: 'SCDream',
                  fontSize: 12.sp,
                  color: Colors.grey[500],
                ),
              ),
            ),
            children: [
              Container(
                width: double.infinity,
                padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h),
                color: Colors.grey[50],
                child: Text(
                  notice['content']!,
                  style: TextStyle(
                    fontFamily: 'SCDream',
                    fontSize: 14.sp,
                    height: 1.5,
                    color: Colors.black87,
                  ),
                ),
              ),
            ],
          );
        },
      ),
    );
  }
}
