import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/presentation/common/app_color.dart';

class BaseBottomSheet extends StatelessWidget {
  const BaseBottomSheet({super.key, required this.child, this.height, this.bgColor});

  final Widget child;
  final double? height;
  final Color? bgColor;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: height ?? MediaQuery.of(context).size.height * 0.85,
      padding: EdgeInsets.symmetric(vertical: 15, horizontal: 20),
      decoration: BoxDecoration(
        color:bgColor?? Colors.white,
        borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
      ),
      child: SingleChildScrollView(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.center,
          spacing: 8,
          children: [
            SizedBox(
              width: MediaQuery.of(context).size.width,
              height: 20,
              child: Stack(
                alignment: AlignmentDirectional.center,
                children: [
                  Container(
                    height: 3,
                    width: 50,
                    decoration: BoxDecoration(color: AppColor.darkGreyDark, borderRadius: BorderRadius.circular(8)),
                  ),

                  Positioned(
                    left: 0,
                    child: IconButton(
                      onPressed: () {
                        Navigator.of(context).pop();
                      },
                      icon: Icon(CupertinoIcons.clear_circled),
                    ),
                  ),
                ],
              ),
            ),

            SizedBox(height: 2),

            child,
          ],
        ),
      ),
    );
  }
}
