/*
 * @Author       : WuWei
 * @LastEditors: wjc
 * @Date         : 2021-04-27 15:41:50
 * @LastEditTime: 2022-12-07 15:19:51
 * @FilePath     : /wisdom-huiguanjia-app/task_package/lib/src/pages/index/components/search.dart
 * @Description  : 任务管理-列表搜索框
 */
part of '../index.dart';

/// 搜索输入框
class _BuildSearchInput extends StatefulWidget {
  _BuildSearchInput({Key? key, this.onInput, this.onCancel, this.title})
      : super(key: key);

  final Function(dynamic v)? onInput;
  final Function()? onCancel;
  final String? title;
  @override
  _SearchInputState createState() => _SearchInputState();
}

class _SearchInputState extends State<_BuildSearchInput> {
  IndexStore get store => Provider.of(context, listen: false);

  @override
  Widget build(BuildContext context) {
    return Wisdom.row(
      // margin: EdgeInsets.only(
      //   bottom: 15.pt,
      // ),
      color: Color(0xFFFFFFFF),
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      // color: Colors.white,
      children: <Widget>[
        /// 输入框
        Expanded(
          child: WSearch(
            hintText: '输入任务标题搜索',
            onSubmitted: (v) => widget.onInput!(v),
            onCancel: () => widget.onCancel!(),
            controller: TextEditingController(text: widget.title ?? ''),
            moonlight: false,
            padding: EdgeInsets.symmetric(vertical: 10.pt),
            isDark: true,
          ),
        ),
      ],
    );
  }
}
