在Flutter的卡片底部设置行

问题描述 投票:0回答:1

我正在尝试像下面的图片那样在抖动中进行特殊设计:

enter image description here

下面的代码给我这个:

enter image description here

               return Container(
                      width: 100.0,
                      child: Card(
                          color: Colors.white,
                          child: Wrap(
                            children: <Widget>[
                              SizedBox(
                                height: 140.0,
                                width: 100.0,
                                child: Image(
                                  image: NetworkImage(image_large +
                                      snapshot.data.results[index]
                                          .posterPath),
                                  fit: BoxFit.cover,
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.all(4.0),
                                child: Column(
                                  crossAxisAlignment:
                                      CrossAxisAlignment.center,
                                  mainAxisAlignment:
                                      MainAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      _getTrendingTitle(
                                          snapshot, index),
                                      textAlign: TextAlign.left,
                                      maxLines: 2,
                                      style: TextStyle(
                                          fontSize: 13,
                                          fontWeight: FontWeight.bold),
                                    ),
                                    Divider(
                                      height: 1,
                                    ),
                                    Row(
                                        mainAxisAlignment:
                                            MainAxisAlignment
                                                .spaceBetween,
                                        children: <Widget>[
                                          _getExactRating(snapshot
                                              .data
                                              .results[index]
                                              .voteAverage),
                                          Text(
                                            ' ' +
                                                snapshot
                                                    .data
                                                    .results[index]
                                                    .voteAverage
                                                    .toString(),
                                            textAlign: TextAlign.left,
                                            maxLines: 2,
                                            style: TextStyle(
                                              fontSize: 10,
                                              fontWeight:
                                                  FontWeight.normal,
                                              color: Colors.black87,
                                            ),
                                          ),
                                          Text(' | '),
                                          _getExactVotes(snapshot
                                              .data
                                              .results[index]
                                              .voteCount),
                                          Text(
                                              _getExactVotesNumber(
                                                  snapshot
                                                      .data
                                                      .results[index]
                                                      .voteCount),
                                              textAlign: TextAlign.left,
                                              maxLines: 2,
                                              style: TextStyle(
                                                  fontSize: 10,
                                                  color: Colors.black87,
                                                  fontWeight: FontWeight
                                                      .normal))
                                        ])
                                  ],
                                ),
                              )
                            ],
                          )));
flutter flutter-layout
1个回答
0
投票

Wrap小部件更改为Column小部件,并像这样提供mainAxisAligment


Column(
     children: [
      Expanded(
        child: Column(
         children: // all other widgets
        )
       ),
       Row()
     ]
)

这将使它们按照您需要的方式对齐

© www.soinside.com 2019 - 2024. All rights reserved.