androidfluttercustomizationcity

Flutter DropdownSearch "No Data Found" Message customization


If the user input for searchbar does not match any of the items in the list, this text will appear.

How can i customize this text? No data found text My Code

Widget cityDropdown() {
    return DropdownSearch(
      validator: (val) => val == null ? 'Bir şehir seçiniz' : null,
      dropdownSearchDecoration: authInputDecoration.copyWith(
        contentPadding: EdgeInsets.fromLTRB(12, 5, 0, 5),
        labelText: 'Şehir',
        labelStyle: TextStyle(
            color: cityFocusNode.hasFocus ? Color(0xff70a43c) : Color(0xffB8B8B8)
        ),
      ),
      searchBoxDecoration: authInputDecoration.copyWith(
          labelText: "Şehrinizi Bulun",
          labelStyle: TextStyle(
            color: Color(0xff70a43c),
          )
      ),
      mode: Mode.BOTTOM_SHEET,
      items: cities,
      showSearchBox: true,
      onChanged: (value) {
        city = value;
      },
    );
  }

Solution

  • check this,

    Using emptyBuilder customise it.

    emptyBuilder: (context, searchEntry) => Center(child: Text('No data',style:TextStyle(color:Colors.blue))),
    

    to remove yellow underline style you've to add scaffold as parent to your widget or Material widget as root element.