- @doc/color.md 가이드라인에 따른 색상 시스템 전면 개편 - 딥 블루(#2563EB), 스카이 블루(#60A5FA) 메인 컬러로 변경 - 모든 화면과 위젯에 글래스모피즘 효과 일관성 있게 적용 - darkNavy, navyGray 등 새로운 텍스트 색상 체계 도입 - 공통 스낵바 및 다이얼로그 컴포넌트 추가 - Claude AI 프로젝트 컨텍스트 파일(CLAUDE.md) 추가 영향받은 컴포넌트: - 10개 스크린 (main, settings, detail, splash 등) - 30개 이상 위젯 (buttons, cards, forms 등) - 테마 시스템 (AppColors, AppTheme) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
142 lines
5.4 KiB
Dart
142 lines
5.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../controllers/add_subscription_controller.dart';
|
|
import '../common/form_fields/currency_input_field.dart';
|
|
import '../common/form_fields/date_picker_field.dart';
|
|
|
|
/// 구독 추가 화면의 이벤트/할인 섹션
|
|
class AddSubscriptionEventSection extends StatelessWidget {
|
|
final AddSubscriptionController controller;
|
|
final Animation<double> fadeAnimation;
|
|
final Animation<Offset> slideAnimation;
|
|
final Function setState;
|
|
|
|
const AddSubscriptionEventSection({
|
|
super.key,
|
|
required this.controller,
|
|
required this.fadeAnimation,
|
|
required this.slideAnimation,
|
|
required this.setState,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FadeTransition(
|
|
opacity: Tween<double>(begin: 0.0, end: 1.0).animate(
|
|
CurvedAnimation(
|
|
parent: controller.animationController!,
|
|
curve: const Interval(0.4, 1.0, curve: Curves.easeIn),
|
|
),
|
|
),
|
|
child: SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(0.0, 0.5),
|
|
end: Offset.zero,
|
|
).animate(CurvedAnimation(
|
|
parent: controller.animationController!,
|
|
curve: const Interval(0.4, 1.0, curve: Curves.easeOutCubic),
|
|
)),
|
|
child: Container(
|
|
margin: const EdgeInsets.only(bottom: 20),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: controller.isEventActive
|
|
? const Color(0xFF3B82F6)
|
|
: Colors.grey.withValues(alpha: 0.2),
|
|
width: controller.isEventActive ? 2 : 1,
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Checkbox(
|
|
value: controller.isEventActive,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
controller.isEventActive = value ?? false;
|
|
if (!controller.isEventActive) {
|
|
// 이벤트 비활성화 시 관련 데이터 초기화
|
|
controller.eventStartDate = DateTime.now();
|
|
controller.eventEndDate = DateTime.now().add(const Duration(days: 30));
|
|
controller.eventPriceController.clear();
|
|
} else {
|
|
// 이벤트 활성화 시 날짜가 null이면 기본값 설정
|
|
controller.eventStartDate ??= DateTime.now();
|
|
controller.eventEndDate ??= DateTime.now().add(const Duration(days: 30));
|
|
}
|
|
});
|
|
},
|
|
activeColor: const Color(0xFF3B82F6),
|
|
),
|
|
const Text(
|
|
'이벤트/할인 설정',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xFF1E293B),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Icon(
|
|
Icons.local_offer,
|
|
size: 20,
|
|
color: controller.isEventActive
|
|
? const Color(0xFF3B82F6)
|
|
: Colors.grey,
|
|
),
|
|
],
|
|
),
|
|
|
|
// 이벤트 활성화 시 추가 필드 표시
|
|
AnimatedContainer(
|
|
duration: const Duration(milliseconds: 300),
|
|
height: controller.isEventActive ? null : 0,
|
|
child: AnimatedOpacity(
|
|
duration: const Duration(milliseconds: 300),
|
|
opacity: controller.isEventActive ? 1.0 : 0.0,
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 20),
|
|
|
|
// 이벤트 기간
|
|
DateRangePickerField(
|
|
startDate: controller.eventStartDate,
|
|
endDate: controller.eventEndDate,
|
|
onStartDateSelected: (date) {
|
|
setState(() {
|
|
controller.eventStartDate = date;
|
|
});
|
|
},
|
|
onEndDateSelected: (date) {
|
|
setState(() {
|
|
controller.eventEndDate = date;
|
|
});
|
|
},
|
|
startLabel: '시작일',
|
|
endLabel: '종료일',
|
|
primaryColor: const Color(0xFF3B82F6),
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// 이벤트 가격
|
|
CurrencyInputField(
|
|
controller: controller.eventPriceController,
|
|
currency: controller.currency,
|
|
label: '이벤트 가격',
|
|
hintText: '할인된 가격을 입력하세요',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |