import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:niogu_app/core/constants/app_color.dart';
import 'package:niogu_app/core/constants/app_font_size.dart';
import 'package:niogu_app/core/widgets/custom_snackbar.dart';
import 'package:sizer/sizer.dart';

class DomainCard extends StatelessWidget {
  final String domainName;
  const DomainCard({super.key, required this.domainName});

  @override
  Widget build(BuildContext context) {
    final bool isTablet = 100.w >= 600;
    return Container(
      padding: EdgeInsets.all(5.w),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(4.w),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.05),
            blurRadius: 10,
            offset: const Offset(0, 4),
          ),
        ],
      ),
      child: Row(
        children: [
          CircleAvatar(
            radius: 7.w,
            backgroundColor: AppColor.primaryColor.withOpacity(0.1),
            child: Icon(
              Icons.language,
              color: AppColor.primaryColor,
              size: 8.w,
            ),
          ),
          SizedBox(width: 4.w),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  domainName,
                  style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: isTablet
                        ? AppFontSize.medium.sp
                        : AppFontSize.small.sp,
                    color: Colors.black87,
                  ),
                ),

                SizedBox(height: 0.75.h),

                Text(
                  "Domain aktif",
                  style: TextStyle(
                    fontSize: isTablet
                        ? (AppFontSize.medium - 1.25).sp
                        : (AppFontSize.small - 1.25).sp,
                    color: Colors.green,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
          ),
          IconButton(
            onPressed: () {
              Clipboard.setData(ClipboardData(text: domainName));
                CustomSnackbar.showSuccess(
                  context,
                  "Domain berhasil disalin",
                );
            },
            icon: Icon(Icons.copy_rounded, size: 5.w, color: Colors.grey),
          ),
        ],
      ),
    );
  
  }
}