如何清除颤动中的空白?

时间:2020-05-22 06:31:01

标签: flutter dart flutter-layout

我想在我的应用程序中删除空白。下面是我的代码。

Scaffold(
        backgroundColor: Theme.of(context).primaryColor,
        extendBodyBehindAppBar: true,
        appBar: AppBar(
          iconTheme: IconThemeData(color: Colors.amber),
          actionsIconTheme: IconThemeData(color: Colors.amber),
          centerTitle: true,
          title: Text(
            'News App',
            style: TextStyle(
              fontSize: 23,
              fontWeight: FontWeight.bold,
            ),
          ),
          backgroundColor: Colors.transparent,
          elevation: 0,
          actions: <Widget>[
            IconButton(
                icon: Icon(Icons.notifications),
                onPressed: () {
                  _showNotification();
                }),
          ],
        ),
        drawer: Menu(),
        body: Container(
          child: Stack(
            children: <Widget>[
              Column(
                children: <Widget>[
                  Container(
                    child: swiperImage(),
                  ),
                  Expanded(
                      child: Padding(
                    padding: EdgeInsets.all(0.0),
                    child: newsList(),
                  ))
                ],
              )
            ],
          ),
        ),
      )

在这里显示输出的图像,在该图像的顶部,我设置了滑动图像,在其余部分中,设置了列表视图。因此,我想删除这两个小部件之间的空白。那么,我该怎么办呢?

img

1 个答案:

答案 0 :(得分:0)

空间在ListView里面。添加此代码,并将其在列表视图中消失。

ListView中:

MediaQuery.removePadding(
    context: context,
    removeTop: true,
    child: ListView.builder()
)