defaultfieldViewBuilder method

Widget defaultfieldViewBuilder(
  1. BuildContext context,
  2. ValueNotifier controller,
  3. ValueNotifier<bool> showClearButton
)

Implementation

Widget defaultfieldViewBuilder(
  BuildContext context,
  ValueNotifier controller,
  ValueNotifier<bool> showClearButton,
) {
  return AppBar(
    automaticallyImplyLeading: false,
    backgroundColor: Colors.transparent,
    elevation: 0.0,
    titleSpacing: 5.0,
    title: Container(
      height: 45,
      decoration: BoxDecoration(
          border: Border.all(color: Colors.grey[400]!),
          borderRadius: BorderRadius.circular(10)),
      child: Row(
        children: [
          IconButton(
            onPressed: () {
              Navigator.pop(context);
            },
            splashRadius: 20,
            icon: const Icon(
              Icons.keyboard_backspace,
              color: Colors.black,
            ),
          ),
          Expanded(
            child: TextField(
              controller: controller.value as TextEditingController,
              autofocus: true,
              textInputAction: TextInputAction.search,
              style: const TextStyle(fontSize: 16, height: 1.5),
              decoration: const InputDecoration(
                // filled: true,
                isDense: true,
                border: InputBorder.none,
                contentPadding:
                    EdgeInsets.symmetric(vertical: 8, horizontal: 8),
              ),
            ),
          ),
          if (showClearButton.value)
            Padding(
              padding: const EdgeInsets.only(right: 5.0),
              child: InkWell(
                child: const Icon(
                  Icons.close_rounded,
                  color: Colors.black,
                ),
                onTap: () {
                  controller.value.text = '';
                },
              ),
            )
        ],
      ),
    ),
  );
}