【发布时间】:2020-03-06 18:43:40
【问题描述】:
我想编辑flappy_search_bar的一些功能
如您所见,加载微调器是蓝色的,我似乎无法将其编辑为任何替代颜色。我也无法编辑也是蓝色的光标颜色。
这是我当前代码块的副本:
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SearchBar<Post>(
searchBarPadding: EdgeInsets.symmetric(horizontal: 20),
headerPadding: EdgeInsets.symmetric(horizontal: 10),
listPadding: EdgeInsets.symmetric(horizontal: 10),
onSearch: _getALlPosts,
hintStyle: TextStyle(color: Colors.black87),
hintText: 'Search',
iconActiveColor: Colors.deepPurpleAccent,
// cursorColor: Colors.deepPurpleAccent,
// loader: Colors.deepPurpleAccent,
textStyle: TextStyle(
fontFamily: 'OpenSans',
fontSize: 18.0,
),`
到目前为止,我已经尝试直接在搜索栏中进行编辑,如上图所示,添加扩展代码如下:
class Styling extends SearchBar {
Styling(this.cursorColor);
final Color cursorColor;
static const accentColor = Colors.deepPurpleAccent;
@override
Widget build(BuildContext context) {
return Theme(
// data: Theme.of(context).copyWith(
// cursorColor: Theme.of(context).accentColor,
// ),
);
}
}
我也尝试过直接编辑包文件,但这也没有成功。
有没有人建议如何编辑 flappy_search_bar 包的光标颜色和加载微调器颜色?
【问题讨论】:
标签: flutter flutter-layout flutter-dependencies