import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

ObxValue<RxBool> searchWidget(
  RxBool searchIsSelected,
  void Function(String) onChanged,
) {
  return ObxValue((data) {
    return AnimatedContainer(
      duration: Duration(milliseconds: 300),
      padding: EdgeInsets.only(top: 5),
      curve: Curves.easeInOut,
      height: data.value ? 50 : 0,
      child: Visibility(
        visible: data.value,
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 8),
          child: RTextField(
            suffixIcon: Padding(
              padding: const EdgeInsets.all(12.0),
              child: Assets.vec.searchSvg.svg(
                width: 10,
                height: 10,
                colorFilter: ColorFilter.mode(
                  AppColor.blueNormal,
                  BlendMode.srcIn,
                ),
              ),
            ),
            hintText: 'جستجو',
            onChanged: onChanged,
            controller: TextEditingController(),
          ),
        ),
      ),
    );
  }, searchIsSelected);
}
