import 'package:cims_apps/application/component/expandable_widget/expandable_widget.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:flutter/material.dart';

class RadioAgreement extends StatelessWidget {
  final void Function() onTap;
  final bool isAgree;
  final String desc;
  const RadioAgreement({super.key, required this.isAgree, required this.desc, required this.onTap,});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          GestureDetector(
            onTap: onTap,
            child: AnimatedContainer(
              margin: const EdgeInsets.only(top: 4),
              duration: const Duration(milliseconds: 200),
              height: 16,
              width: 16,
              padding: const EdgeInsets.all(1),
              alignment: Alignment.center,
              decoration: BoxDecoration(
                  shape: BoxShape.circle,
                  border: Border.all(
                      color: isAgree
                          ? ColorPalette.primary
                          : ColorPalette.slate200)),
              child: AnimatedContainer(
                duration: const Duration(milliseconds: 200),
                child: Container(
                  decoration: BoxDecoration(
                      color:
                      isAgree ? ColorPalette.primary : ColorPalette.white,
                      shape: BoxShape.circle),
                ),
              ),
            ),
          ),
          const SizedBox(
            width: 12,
          ),
          Expanded(
            child: ExpandableWidget(
              content: desc,
              maxLinesToShow: 3,
            )
          )
        ],
      ),
    );
  }
}
