小部件未展开

时间:2020-10-27 03:33:53

标签: flutter flutter-layout

我的拍打有问题。 我用每个项目的显示索引和一些信息创建列表。问题是我的信息没有采用该行可用的大小。您可以在图片中看到:

text is not expanded, I hope text is expanding and take the size.

这是我的代码:

        width: MediaQuery.of(context).size.width,
        child: InkWell(
          onTap: () => _showDetailDialog(activityLog),
          splashColor: Colors.grey,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Container(
                padding: EdgeInsets.all(8.0),
                child: Row(
                  mainAxisSize: MainAxisSize.max,
                  children: [
                    Flexible(
                      child: FittedBox(
                        fit: BoxFit.scaleDown,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '${(startItem + index) + 1}',
                            style: TextStyle(fontWeight: FontWeight.bold),
                          ),
                        ),
                      ),
                    ),
                    Expanded(
                      child: Text('oapejfajemflkjapofjaowfnpawjf[ajpfjawpkfpoawkfpoawpfainefo;iajfoiawjpfjawpjfpamefpjapiefjaiopwjfepoawjpfojeawopfjwaop'),
//                      child:
//                    _createTitle(activityLog),
                    )
                  ],
                ),
              ),
              Divider(
                thickness: 2,
                color: Colors.grey,
              )
            ],
          ),
        ),
      );

1 个答案:

答案 0 :(得分:0)

crossAxisAlignment小部件的CrossAxisAlignment.stretch值与Column一起传递给mainAxisAlignment