- Extract business logic from screens into dedicated controllers - Split large screen files into smaller, reusable widget components - Add controllers for AddSubscriptionScreen and DetailScreen - Create modular widgets for subscription and detail features - Improve code organization and maintainability - Remove duplicated code and improve reusability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
178 lines
6.6 KiB
Dart
178 lines
6.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../controllers/detail_screen_controller.dart';
|
|
import '../common/form_fields/base_text_field.dart';
|
|
import '../common/buttons/secondary_button.dart';
|
|
|
|
/// 웹사이트 URL 섹션
|
|
/// 서비스 웹사이트 URL과 해지 관련 정보를 관리하는 섹션입니다.
|
|
class DetailUrlSection extends StatelessWidget {
|
|
final DetailScreenController controller;
|
|
final Animation<double> fadeAnimation;
|
|
final Animation<Offset> slideAnimation;
|
|
|
|
const DetailUrlSection({
|
|
super.key,
|
|
required this.controller,
|
|
required this.fadeAnimation,
|
|
required this.slideAnimation,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final baseColor = controller.getCardColor();
|
|
|
|
return FadeTransition(
|
|
opacity: fadeAnimation,
|
|
child: SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(0.0, 0.8),
|
|
end: Offset.zero,
|
|
).animate(CurvedAnimation(
|
|
parent: controller.animationController!,
|
|
curve: const Interval(0.4, 1.0, curve: Curves.easeOutCubic),
|
|
)),
|
|
child: Card(
|
|
elevation: 1,
|
|
shadowColor: Colors.black12,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// 헤더
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: baseColor.withValues(alpha: 0.1),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Icon(
|
|
Icons.language_rounded,
|
|
color: baseColor,
|
|
size: 24,
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
const Text(
|
|
'웹사이트 정보',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// URL 입력 필드
|
|
BaseTextField(
|
|
controller: controller.websiteUrlController,
|
|
focusNode: controller.websiteUrlFocus,
|
|
label: '웹사이트 URL',
|
|
hintText: 'https://example.com',
|
|
keyboardType: TextInputType.url,
|
|
prefixIcon: Icon(
|
|
Icons.link_rounded,
|
|
color: Colors.grey[600],
|
|
),
|
|
),
|
|
|
|
// 해지 안내 섹션
|
|
if (controller.subscription.websiteUrl != null &&
|
|
controller.subscription.websiteUrl!.isNotEmpty) ...[
|
|
const SizedBox(height: 24),
|
|
Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.orange.withValues(alpha: 0.1),
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: Colors.orange.withValues(alpha: 0.3),
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.info_outline_rounded,
|
|
color: Colors.orange[700],
|
|
size: 20,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'해지 안내',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.orange[700],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'이 서비스를 해지하려면 아래 링크를 통해 해지 페이지로 이동하세요.',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.grey[700],
|
|
height: 1.5,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
TextLinkButton(
|
|
text: '해지 페이지로 이동',
|
|
icon: Icons.open_in_new_rounded,
|
|
onPressed: controller.openCancellationPage,
|
|
color: Colors.orange[700],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
|
|
// URL 자동 매칭 정보
|
|
if (controller.websiteUrlController.text.isEmpty) ...[
|
|
const SizedBox(height: 16),
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: Colors.blue.withValues(alpha: 0.1),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.auto_fix_high_rounded,
|
|
color: Colors.blue[700],
|
|
size: 20,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
'URL이 비어있으면 서비스명을 기반으로 자동 매칭됩니다',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.blue[700],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |