import 'package:flutter/material.dart';
import '../../controllers/detail_screen_controller.dart';
import '../common/buttons/primary_button.dart';
import '../../l10n/app_localizations.dart';

/// 상세 화면 액션 버튼 섹션
/// 저장 버튼을 포함하는 섹션입니다.
class DetailActionButtons extends StatelessWidget {
  final DetailScreenController controller;
  final Animation<double> fadeAnimation;
  final Animation<Offset> slideAnimation;

  const DetailActionButtons({
    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: Padding(
          padding: const EdgeInsets.only(bottom: 80),
          child: PrimaryButton(
            text: AppLocalizations.of(context).saveChanges,
            icon: Icons.save_rounded,
            onPressed: controller.updateSubscription,
            isLoading: controller.isLoading,
            backgroundColor: baseColor,
          ),
        ),
      ),
    );
  }
}
