Wrap multiple Chip create overflow - Flutter

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

在我的应用程序上创建个人资料页面的方式,我有这个代码示例:

return Container(
          height: 30.h,
          child: Row(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                const ProfilPic(),
                SizedBox(
                  width: 5.w,
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      data['pseudo'],
                      style: Theme.of(context).textTheme.titleMedium,
                    ),
                    Text(
                      'Membre depuis : $userCreationDateFormatted',
                      style: Theme.of(context).textTheme.headlineLarge,
                    ),
                    data['role'] == 'admin'
                        ? const Text(
                            'Administrateur',
                          )
                        : Container(),
                    SizedBox(
                      height: 2.h,
                    ),
                    Wrap(children: [
                      Chip(
                        label: Text(
                          '#${data['fav_genre']}',
                          overflow: TextOverflow.ellipsis,
                          style: Theme.of(context).textTheme.bodyLarge,
                        ),
                      ),
                      Chip(
                        label: Text(
                          '#${data['pref']}',
                          overflow: TextOverflow.ellipsis,
                          style: Theme.of(context).textTheme.bodyLarge,
                        ),
                      ),
                      Chip(
                        label: Text(
                          '#${data['top_']}',
                          overflow: TextOverflow.ellipsis,
                          style: Theme.of(context).textTheme.bodyLarge,
                        ),
                      ),
                      Chip(
                        label: Text(
                          data['top_anime'],
                          overflow: TextOverflow.ellipsis,
                          style: Theme.of(context).textTheme.bodyLarge,
                        ),
                      ),
                    ]),
                  ],
                )
              ]));

问题是我有溢出,即使使用“Wrap”小部件也是如此。

我认为主容器有问题,因为当我在我的应用程序的另一部分尝试我的代码时,它工作正常。但我不知道为什么。 我什至尝试用“SingleChildScrollView”包裹“Wrap”,但它不起作用。

flutter dart overflow word-wrap
© www.soinside.com 2019 - 2024. All rights reserved.