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

class CustomEmptyScreen extends StatelessWidget {
  final String? title;
  final String body;
  final String? textButton;
  final VoidCallback? onPressed;

  const CustomEmptyScreen({
    super.key,
    this.title,
    required this.body,
    this.textButton,
    this.onPressed,
  });

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      physics: const AlwaysScrollableScrollPhysics(),
      padding: EdgeInsets.symmetric(vertical: 3.h),
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            if (title != null) ...[
              Text(
                title!,
                style: TextStyle(
                  fontSize: AppFontSize.large.sp,
                  fontWeight: FontWeight.bold,
                  color: Colors.black,
                ),
              ),
              SizedBox(height: 1.h),
            ],
            Text(
              body,
              style: TextStyle(
                fontSize: AppFontSize.small.sp,
                color: Colors.grey,
              ),
            ),
            SizedBox(height: 1.5.h),

            Icon(
              Icons.search_off_rounded,
              size: 15.h,
              color: Colors.grey.shade300,
            ),

            if (onPressed != null && textButton != null) ...[
              SizedBox(height: 1.5.h),

              SizedBox(
                width: 70.w,
                height: 6.h,
                child: ElevatedButton(
                  onPressed: onPressed,
                  style: ElevatedButton.styleFrom(
                    backgroundColor: AppColor.primaryColor,
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(2.05.w),
                    ),
                  ),
                  child: Text(
                    textButton!,
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: AppFontSize.medium.sp,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
              ),
            ],
          ],
        ),
      ),
    );
  }
}
