searchBox method

Widget searchBox(
  1. CometChatTheme theme,
  2. BuildContext context
)

Implementation

Widget searchBox(CometChatTheme theme, BuildContext context) {
  return Padding(
        padding: const EdgeInsets.only(bottom: 12),
      child: SizedBox(
        height: 52,
        child: Center(
          child: TextField(
            //--------------------------------------
            //----------on search callback----------
            controller: TextEditingController(text: searchText),
            onChanged: onSearch,
            keyboardAppearance:
                theme.palette.mode == PaletteThemeModes.light
                    ? Brightness.light
                    : Brightness.dark,
            style: style.searchTextStyle ??
                TextStyle(
                    color: AppTheme.white,
                    fontSize: theme.typography.body.fontSize,
                    fontWeight: theme.typography.body.fontWeight),

            //-----------------------------------------
            //----------search box decoration----------
            decoration: InputDecoration(
                contentPadding: const EdgeInsets.all(0),
                hintText:
                    placeholder ?? Translations.of(context).search,
                prefixIcon: searchBoxIcon ??
                    Icon(
                      Icons.search,
                      color: style.searchIconTint ??
                          AppTheme.light,
                    ),
                prefixIconColor: style.searchIconTint,
                hintStyle:
                    // style.searchTextStyle ??
                    style.searchPlaceholderStyle ??
                        const TextStyle(
                            color: AppTheme.light,
                            fontSize: 14,
                            fontWeight: FontWeight.w400),

                //-------------------------------------
                //----------search box border----------
                focusedBorder: OutlineInputBorder(
                    borderSide: style.searchBorderColor == null
                        ? BorderSide.none
                        : BorderSide(
                            color: style.searchBorderColor!,
                            width: style.searchBorderWidth ?? 1),
                    borderRadius: BorderRadius.circular(
                        style.searchBoxRadius ?? 28)),
                enabledBorder: OutlineInputBorder(
                    borderSide: style.searchBorderColor == null
                        ? BorderSide.none
                        : BorderSide(
                            color: style.searchBorderColor!,
                            width: style.searchBorderWidth ?? 1),
                    borderRadius: BorderRadius.circular(
                        style.searchBoxRadius ?? 28)),
                border: OutlineInputBorder(
                    borderSide: style.searchBorderColor == null
                        ? BorderSide.none
                        : BorderSide(
                            color: style.searchBorderColor!,
                            width: style.searchBorderWidth ?? 1),
                    borderRadius: BorderRadius.circular(
                        style.searchBoxRadius ?? 28)),

                //-----------------------------------------
                //----------search box fill color----------
                fillColor: style.searchBoxBackground ??
                    const Color(0x80212C41), //AppTheme.accent,
                filled: true),
          ),
        ),
      ),
  );
}