Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置 margin 后输入文本整体偏下,刚好是未设置margin时居中的位置 #1

Closed
amd110 opened this issue Jun 23, 2020 · 2 comments

Comments

@amd110
Copy link

amd110 commented Jun 23, 2020

[✓] 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');
},
),
),
);
}
}

device-2020-06-23-165812
device-2020-06-23-170213

@amd110
Copy link
Author

amd110 commented Jun 24, 2020

是不是有最小高度限制,我看把高度加大就没事 @FliggyAndroid

@chenBingX
Copy link
Member

这个问题已经在 1.0.1 版本中得到适配。
欢迎继续对 FWidget 保持关注.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants