如何减少颤动中的小部件之间的空间

时间:2020-08-26 04:59:36

标签: flutter listview dart widget

嗨,我已经设计了一个屏幕。在上方,我有一个按钮和一个文本,在第二处,我有一个列表视图。 我想缩小第一种和第二种布局之间的差距。

This is the image in which I marked red. That red marked space I want to reduce 我正在按如下方式调用小部件的主体列。

 Widget body = new Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        toplayout,
        listScreen,
        startButtonlayout
      ],
    );

第一种布局如下

 Widget toplayout = new Container(
      width: 70,
      height: 70,
      color: Colors.red,
      child: new Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Builder(builder: (context) => IconButton(
            icon: Icon(Icons.arrow_back),
            iconSize: 30,
            onPressed: () {
              // Here i want context
              if (Navigator.canPop(context)) {
                Navigator.pop(context);
              } else {
                SystemNavigator.pop();
              }
            },
          ),),
          new Container(
              margin: const EdgeInsets.fromLTRB(20, 0, 0, 0),
              child: new Text("Day 1",
                  style: new TextStyle(
                    fontSize: 30,
                    color: Colors.black,
                  )))
        ],
      ),
    );
    
    Widget listScreen = new Expanded(
      child: new Container(
        child: new ListViewExample(),
      ),
    );
    
    class ListViewExample extends StatefulWidget {
   
      @override
      State<StatefulWidget> createState() {
        SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
          statusBarColor: Colors.transparent,
        ));
        SystemChrome.setEnabledSystemUIOverlays(
            [SystemUiOverlay.top, SystemUiOverlay.bottom]);
        // TODO: implement createState
        return ExerciseListPage();
      }
    
    }

这是列表

  List<GestureDetector> _buildListItemsfromFlower() {
    return flowers.map((flowers) {
      var flatbutton = GestureDetector(
          child: Card(
              elevation: 10.0,
              child: new Row(
                textBaseline: TextBaseline.alphabetic,
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  new Container(
                      child: new Column(
                    children: <Widget>[
                      new Container(
                        width: MediaQuery.of(context).size.width * 0.5,
                        height: MediaQuery.of(context).size.height / 15,)))

由于列中的小部件之间的间隙越来越大,我想减少它。我没有提到任何空白。

0 个答案:

没有答案