如何更改显示列表的字体大小(下拉搜索)



我正在尝试下拉搜索库,但无法更改显示列表中的字体大小(dropdown_search(?

return new Container(
child: DropdownSearch<Type2>(
//  pop
searchFieldProps: TextFieldProps(
style: TextStyle(fontSize: 12.0),
controller: _PropertyTypeController,
decoration: InputDecoration(

labelStyle: TextStyle(fontSize: 12.0),
floatingLabelStyle: TextStyle(fontSize: 12.0),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_PropertyTypeController.clear();
},
),
),
),
maxHeight: 300,
dropdownSearchBaseStyle: TextStyle(fontSize: 12.0),
onFind: (filter) => getTypeSuggestions(
filter.toString(),

),
dropdownSearchDecoration: InputDecoration(
labelStyle: TextStyle(fontSize: 12.0),
labelText: "choose a Property Type",
contentPadding: EdgeInsets.fromLTRB(12, 12, 0, 0),
border: OutlineInputBorder(),
),
onChanged: print,
showSearchBox: true,
popupShape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
),
margin: EdgeInsets.only(bottom: 10.0));
}

显示字体较大,希望在整个应用程序中缩小到标准字体大小。

我不确定它是否与您的问题相关,但它可能会帮助您

DropdownButton(
value: selectedValue,
style: TextStyle(color: Colors.red,fontSize: 30),
onChanged: (String? newValue){
setState(() {
selectedValue = newValue!;
});
},
items: dropdownItems
)

您可以更改字体大小,有关更多信息,请访问此链接:设置下拉的样式

如果您使用的是pub.dev中的dropdown_search 2.0.1包,那么这是不可能的,因为在textstyle中没有更改项目字体大小的选项。以下是您可以使用inputdecoration所做的一切:

(new) InputDecoration InputDecoration({
Widget? icon,
Widget? label,
String? labelText,
TextStyle? labelStyle,
TextStyle? floatingLabelStyle,
String? helperText,
TextStyle? helperStyle,
int? helperMaxLines,
String? hintText,
TextStyle? hintStyle,
TextDirection? hintTextDirection,
int? hintMaxLines,
String? errorText,
TextStyle? errorStyle,
int? errorMaxLines,
FloatingLabelBehavior? floatingLabelBehavior,
bool isCollapsed = false,
bool? isDense,
EdgeInsetsGeometry? contentPadding,
Widget? prefixIcon,
BoxConstraints? prefixIconConstraints,
Widget? prefix,
String? prefixText,
TextStyle? prefixStyle,
Widget? suffixIcon,
Widget? suffix,
String? suffixText,
TextStyle? suffixStyle,
BoxConstraints? suffixIconConstraints,
Widget? counter,
String? counterText,
TextStyle? counterStyle,
bool? filled,
Color? fillColor,
Color? focusColor,
Color? hoverColor,
InputBorder? errorBorder,
InputBorder? focusedBorder,
InputBorder? focusedErrorBorder,
InputBorder? disabledBorder,
InputBorder? enabledBorder,
InputBorder? border,
bool enabled = true,
String? semanticCounterText,
bool? alignLabelWithHint,
BoxConstraints? constraints,
})

最新更新