import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';

class PatientSearchHeader extends StatelessWidget
    implements PreferredSizeWidget {
  final String? title;
  final bool showSearchIcon;
  final VoidCallback? onSearchPressed;
  final double? fontSize;


  const PatientSearchHeader(
      {Key? key, this.title, this.showSearchIcon = false, this.onSearchPressed, this.fontSize})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 120,
      padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
      decoration: BoxDecoration(
        color: Colors.white,
      ),
      child: Container(
        padding: EdgeInsets.only(left: 10, right: 10, bottom: 5),
        margin: EdgeInsets.only(top: 35),
        child: Row(children: [
          IconButton(
            icon: Icon(Icons.arrow_back_ios),
            color: Color(0xFF2B353E), //Colors.black,
            onPressed: () => Navigator.pop(context),
          ),
          Expanded(
            child: AppText(
              title!,
              fontSize:fontSize ?? 24.0,
              fontWeight: FontWeight.w700,
              color: Color(0xFF2B353E),
              fontFamily: 'Poppins',
              letterSpacing: -1.44,
            ),
          ),
          Visibility(
            visible: showSearchIcon,
            child: IconButton(
              icon: Icon(Icons.search),
              color: Color(0xFF2B353E), //Colors.black,
              onPressed: () => onSearchPressed?.call(),
            ),
          ),
        ]),
      ),
    );
  }

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