
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart';

class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget {
  BottomSheetTitle({
    Key? key,
    this.title = '',
    this.isClose =true,
    this.onCrossClicked
  }) : super(key: key);
  bool isClose;
  final String title;
  final VoidCallback? onCrossClicked;
  double headerHeight = SizeConfig.heightMultiplier! * 15;

  @override
  Widget build(BuildContext context) {
    return Container(
      // padding: EdgeInsets.only(
      //     left: 0, right: 5, bottom: 5, top: 5),
      decoration: BoxDecoration(
        color: Colors.white,
      ),
      height: headerHeight,
      child: Center(
        child: Container(
          padding: EdgeInsets.only(left: 10, right: 10),
          margin: EdgeInsets.only(top: headerHeight * 0.5),
          child: Column(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  RichText(
                    text: TextSpan(
                      style: TextStyle(fontSize: 20, color: Colors.black),
                      children: <TextSpan>[
                        new TextSpan(text: title, style: TextStyle(color: Color(0xFF2B353E), fontWeight: FontWeight.w700, fontFamily: 'Poppins', letterSpacing: -1.44, fontSize: 24.0)),
                      ],
                    ),
                  ),
                  InkWell(
                      onTap: () {
                        Navigator.pop(context);
                        onCrossClicked?.call();
                      },
                      child: isClose  ? Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E)) :SizedBox())
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  @override
  Size get preferredSize => Size(double.maxFinite, headerHeight);
}
