提交 25667735 authored 作者: 史晓晨's avatar 史晓晨

feat:SearchAppBar去除软键盘控制

上级 1090257f
......@@ -76,93 +76,88 @@ class _SearchAppBarState extends State<SearchAppBar> {
@override
Widget build(BuildContext context) {
return KeyboardActions(
config:
KeyBoardUtils.getKeyboardActionsConfig(context, [_searchFocusNode]),
tapOutsideBehavior: TapOutsideBehavior.opaqueDismiss,
child: AppBar(
backgroundColor: widget.backgroundColor,
foregroundColor: widget.foregroundColor,
titleSpacing: 0.0,
primary: widget.primary,
leading: widget.leading,
leadingWidth: widget.leadingWidth,
automaticallyImplyLeading: widget.automaticallyImplyLeading,
title: Row(
children: <Widget>[
Expanded(
child: Container(
margin: widget.margin,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(widget.searchBgRadius ?? 20.0)),
color:
widget.searchBackgroundColor ?? const Color(0xFFEEEEEE),
),
child: Row(
children: <Widget>[
hGap10,
widget.leftWidget ??
Icon(
Icons.search,
color: widget.searchIconColor ?? Colors.grey.shade300,
size: widget.searchIconSize,
),
hGap5,
Expanded(
child: TextField(
maxLines: 1,
maxLength: widget.maxLength,
focusNode: _searchFocusNode,
style: TextStyle(
fontSize: 14,
color: widget.inputTextColor ??
const Color(0xFF000000)),
textInputAction: TextInputAction.search,
controller: _searchInfoController,
onSubmitted: (value) => _search(),
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
horizontal: 0.0, vertical: 8.0),
isDense: true,
counterText: "",
hintText: widget.hintText,
hintStyle: TextStyle(
fontSize: 14.0,
color: widget.hintTextColor ??
const Color(0xFF999999)),
border: InputBorder.none, //去掉下划线
//hintStyle: TextStyles.textGrayC14
),
return AppBar(
backgroundColor: widget.backgroundColor,
foregroundColor: widget.foregroundColor,
titleSpacing: 0.0,
primary: widget.primary,
leading: widget.leading,
leadingWidth: widget.leadingWidth,
automaticallyImplyLeading: widget.automaticallyImplyLeading,
title: Row(
children: <Widget>[
Expanded(
child: Container(
margin: widget.margin,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(widget.searchBgRadius ?? 20.0)),
color:
widget.searchBackgroundColor ?? const Color(0xFFEEEEEE),
),
child: Row(
children: <Widget>[
hGap10,
widget.leftWidget ??
Icon(
Icons.search,
color: widget.searchIconColor ?? Colors.grey.shade300,
size: widget.searchIconSize,
),
hGap5,
Expanded(
child: TextField(
maxLines: 1,
maxLength: widget.maxLength,
focusNode: _searchFocusNode,
style: TextStyle(
fontSize: 14,
color: widget.inputTextColor ??
const Color(0xFF000000)),
textInputAction: TextInputAction.search,
controller: _searchInfoController,
onSubmitted: (value) => _search(),
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
horizontal: 0.0, vertical: 8.0),
isDense: true,
counterText: "",
hintText: widget.hintText,
hintStyle: TextStyle(
fontSize: 14.0,
color: widget.hintTextColor ??
const Color(0xFF999999)),
border: InputBorder.none, //去掉下划线
//hintStyle: TextStyles.textGrayC14
),
),
],
),
),
],
),
),
widget.rightText.isNullOrEmpty()
? const SizedBox(width: 15.0)
: InkWell(
onTap: () {
widget.onRightBtnCallback != null
? widget.onRightBtnCallback?.call()
: _search();
},
child: Container(
width: 60.0,
height: 50.0,
alignment: Alignment.center,
child: Text(
widget.rightText ?? "搜索",
style: TextStyle(
color: widget.rightTextColor ??
const Color(0xFFFFFFFF),
fontSize: 14.0),
),
),
widget.rightText.isNullOrEmpty()
? const SizedBox(width: 15.0)
: InkWell(
onTap: () {
widget.onRightBtnCallback != null
? widget.onRightBtnCallback?.call()
: _search();
},
child: Container(
width: 60.0,
height: 50.0,
alignment: Alignment.center,
child: Text(
widget.rightText ?? "搜索",
style: TextStyle(
color: widget.rightTextColor ??
const Color(0xFFFFFFFF),
fontSize: 14.0),
),
)
],
),
),
)
],
),
);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论