简体   繁体   English

Flutter AppBar添加白色边框

[英]Flutter AppBar adding white border

Trying to create a custom navigation bar at the top of the screen. 尝试在屏幕顶部创建自定义导航栏。 Currently with the below code I'm getting a white border around my nav bar. 目前,使用以下代码,我的导航栏周围出现白色边框。 Anyway to fix this? 有任何解决这个问题的方法吗? I've evaluated it's not the actual header as if it's in the body of the scaffold it fits 100% to the size. 我已经评估过,它不是实际的标头,就好像它在脚手架的主体中,适合其大小的100%。

Widget build(BuildContext context) {
Widget body = Body();
Widget header = Header();

return new Scaffold(

    appBar: new PreferredSize(
      preferredSize: Size(1000.0, 1000.0),
      child: new Card(
        child: header
      )),
    body: ListView(
      children: [
        body
      ],
    )
  );

在此处输入图片说明

Card widget by default sets all its margins to 4.0. 默认情况下,“ 卡片”小部件将其所有边距设置为4.0。 Override that value in your build method and you should be good: 在构建方法中覆盖该值,您应该会很好:

child: new Card(
  margin: EdgeInsets.zero,
  child: header
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM