设置 margin 后输入文本整体偏下,刚好是未设置margin时居中的位置
amd110 opened this issue · comments
[✓] 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');
},
),
),
);
}
}
是不是有最小高度限制,我看把高度加大就没事 @FliggyAndroid
这个问题已经在 1.0.1
版本中得到适配。
欢迎继续对 FWidget 保持关注.