import 'package:clean/utils/expand.dart';
import 'package:flutter/Material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../resource/assets.gen.dart';

class PrivacyLockDialog extends StatelessWidget {
  final bool isPrivacyOn;
  final VoidCallback? onResetPassword;
  final VoidCallback? onSetPublic;

  const PrivacyLockDialog({
    super.key,
    required this.isPrivacyOn,
    this.onResetPassword,
    this.onSetPublic,
  });

  @override
  Widget build(BuildContext context) {
    return Dialog(
      backgroundColor: "#23232A".color,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(26.r),
      ),
      child: Container(
        width: 285.w,
        padding: EdgeInsets.all(20),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            // 锁图标
            isPrivacyOn
                ? Assets.images.iconPrivacyLock.image(width: 76.w, height: 76.w)
                : Assets.images.iconPrivacyUnlock
                    .image(width: 76.w, height: 76.w),
            SizedBox(height: 16),
            // 标题文本
            Text(
              'Privacy Mode ${isPrivacyOn ? "On" : "Off"}',
              style: TextStyle(
                color: Colors.white,
                fontSize: 20.sp,
                fontWeight: FontWeight.w700,
              ),
            ),
            SizedBox(height: 24),

            // 重置密码按钮
            GestureDetector(
              onTap: () {
                onResetPassword!();
              },
              child: Container(
                width: 180.w,
                height: 48.h,
                decoration: BoxDecoration(
                  color: "#0279FB".color,
                  borderRadius: BorderRadius.circular(10.r),
                ),
                child: Center(
                  child: Text(
                    isPrivacyOn ? 'Reset Password' : 'Set Password',
                    style: TextStyle(
                      fontSize: 16.sp,
                      fontWeight: FontWeight.w500,
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
            ),
            SizedBox(height: 15.h),
            // 设为公开按钮
            Visibility(
              visible: isPrivacyOn,
              child: TextButton(
                onPressed: onSetPublic,
                child: Text(
                  'Set as Public',
                  style: TextStyle(
                    color: Colors.white.withOpacity(0.7),
                    fontSize: 16,
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
