fliggy-mobile / fsearch Goto Github PK
View Code? Open in Web Editor NEWHelp developers build the most beautiful search bar🍹.
License: Other
Help developers build the most beautiful search bar🍹.
License: Other
hittest提示语应该能够直接搜索的,比如一些推荐内容将显示再搜索提示语里面,然后用户能直接按hittest来搜索
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
For solutions, see https://dart.dev/go/unsound-null-safety
什么情况?
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.5 19F101, locale zh-Hans-CN)
• Flutter version 1.17.1 at ***
• Framework revision f7a6a7906b (6 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
代码:
class SearchBar extends StatelessWidget implements PreferredSizeWidget {
Color appBarBackgroundColor;
SearchBar({this.appBarBackgroundColor});
@OverRide
Size get preferredSize => Size.fromHeight(kToolbarHeight);
@OverRide
Widget build(BuildContext context) {
appBarBackgroundColor ??= Theme.of(context).appBarTheme.color;
return Container(
color: appBarBackgroundColor,
child: SafeArea(
child: FSearch(
enable: true,
width: double.maxFinite,
height: double.maxFinite,
corner: FSearchCorner.all(18.0),
cornerStyle: FSearchCornerStyle.round,
strokeColor: UiColors.primaryColor,
strokeWidth: 0.5,
backgroundColor: appBarBackgroundColor,
shadowColor: UiColors.textGrey3,
shadowOffset: Offset(2.0, 2.0),
shadowBlur: 4.0,
padding: EdgeInsets.fromLTRB(10, 0, 20, 0),
// margin: EdgeInsets.fromLTRB(16, 10, 16, 10),
style: TextStyle(fontSize: 18, color: UiColors.textGrey0),
prefixes: [
Padding(
padding: EdgeInsets.only(left: 5, top: 6, bottom: 5),
child: Icon(Icons.search, color: UiColors.textGrey1),
)
],
hints: ['大家都在搜:李沁'],
hintStyle: TextStyle(fontSize: 18, color: UiColors.textGrey1),
onTap: () {
log('onTap');
},
),
),
);
}
}
点击搜索框键盘弹出后,怎么做到点击其非输入框区域就能收回键盘呢。demo 不会回收键盘用户体验不好吧,除非主导点了那个clearfocus
FSearch(
corner: FSearchCorner(
leftTopCorner: 18,
leftBottomCorner: 18,
rightTopCorner: 18,
rightBottomCorner: 18),
cornerStyle: FSearchCornerStyle.round,
strokeColor: Colors.blue,
center: true,
hints: ["请输入讲师姓名搜索"],
// hintPrefix: Icon(Icons.search),
width: width - 80,
height: 36,
backgroundColor: ColorUtil.fromHex("#F4F5F6"),
hintStyle: TextStyle(fontSize: 14),
)
现在输入只能一行
这个是我的代码
FSearch(
controller: controller,
height: 30,
backgroundColor: Colours.bg_gray,
corner: FSearchCorner.all(14),
style: TextStyle(fontSize: 12.0, color: Colors.black),
margin: EdgeInsets.only(left: 12.0, right: 12.0),
hints: ["", ""],
hintStyle: TextStyle(fontSize: 12.0, color: Colors.black),
prefixes: [
const SizedBox(width: 15.0),
Icon(
Icons.search,
size: 18,
color: Colours.text_tab_black,
),
const SizedBox(width: 3.0)
],
onSearch: (value) {
setState(() {});
},
),
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.