import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class SearchUnbookableSpacesWidget extends StatelessWidget {
  final String title;
  final Widget? suffix;
  final double? height;
  final double? width;
  final TextEditingController? controller;
  final List<TextInputFormatter>? inputFormatters;
  final void Function(String)? onChanged;
  const SearchUnbookableSpacesWidget({
    required this.title,
    this.controller,
    this.onChanged,
    this.suffix,
    this.height,
    this.width,
    this.inputFormatters,
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width ?? 480,
      height: height ?? 30,
      padding: const EdgeInsets.only(top: 4),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12),
        boxShadow: const [
          BoxShadow(
            color: Color(0x26000000),
            offset: Offset(0, 4),
            blurRadius: 5,
          ),
        ],
      ),
      child: TextField(
        controller: controller,
        inputFormatters: inputFormatters,
        onChanged: onChanged,
        decoration: InputDecoration(
          contentPadding:
              const EdgeInsets.symmetric(vertical: 5, horizontal: 15),
          hintText: title,
          hintStyle: const TextStyle(color: Colors.grey),
          border: InputBorder.none,
          suffixIcon:
              suffix ?? const Icon(Icons.search, size: 20, color: Colors.grey),
        ),
        style: const TextStyle(
          fontSize: 14,
          color: Colors.grey,
        ),
      ),
    );
  }
}
