flutter 文本溢出出现几分之一秒

qybjjes1  于 2023-03-04  发布在  Flutter
关注(0)|答案(1)|浏览(118)

我有一个带有Listview的主屏幕。builder,当我点击Listview项目内的任何项目时,点击会将我发送到另一个屏幕,其中包含有关该项目的详细信息,我正在打开另一个屏幕或小部件时使用英雄动画。现在,当另一个屏幕打开时,它会在文本下方显示黄线几分之一秒,然后消失。我设法捕获了一个截图,以显示发生了什么。

return SafeArea(
  child: Scaffold(
    body: LayoutBuilder(
      builder: (p0, constraints) => Hero(
        tag: productLink,
        child: Stack(
          children: [
            Column(
              children: [
                //Main image, title, backButton
                Flexible(
                  child: Stack(
                    alignment: Alignment.bottomRight,
                    children: [
                      AspectRatio(
                        aspectRatio: 16 / 9,
                        child: Image.asset(
                          'assets/dummy/dummy-2.jpg',
                          width: double.infinity,
                          fit: BoxFit.cover,
                        ),
                      ),
                      Align(
                        alignment: Alignment.bottomRight,
                        heightFactor: 1,
                        child: Padding(
                          padding: EdgeInsets.symmetric(
                            horizontal: constraints.maxWidth * .05,
                            vertical: constraints.maxWidth * .02,
                          ),
                          child: Icon(
                            Icons.crop_free_sharp,
                            color: Colors.white.withOpacity(.7),
                            size: Sizes.SIZE_36,
                          ),
                        ),
                      ),
                      //Title
                      Align(
                        alignment: Alignment.bottomLeft,
                        heightFactor: 1,
                        child: Padding(
                          padding: EdgeInsets.symmetric(
                            horizontal: constraints.maxWidth * .03,
                            vertical: constraints.maxWidth * .04,
                          ),
                          child: Text(
                            'Just an empty Adress',
                            style: TextStyle(
                              color: Colors.white.withOpacity(.7),
                              fontSize: Sizes.TEXT_SIZE_20,
                              fontFamily: 'Intel',
                            ),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
                Flexible(
                  child: SizedBox(
                    height: 100,
                    width: double.infinity,
                    child: Stack(
                      children: [
                        Row(
                          children: [
                            Flexible(
                              child: Image.asset(
                                'assets/dummy/dummy-3.jpg',
                                height: 100,
                                width: constraints.maxWidth / 3,
                                fit: BoxFit.cover,
                                cacheWidth: 1440,
                                cacheHeight: 810,
                              ),
                            ),
                            Flexible(
                              child: Image.asset(
                                'assets/dummy/dummy-4.jpg',
                                height: 100,
                                width: constraints.maxWidth / 3,
                                fit: BoxFit.cover,
                              ),
                            ),
                            Flexible(
                              child: Image.asset(
                                'assets/dummy/dummy-5.jpg',
                                height: 100,
                                width: constraints.maxWidth / 3,
                                fit: BoxFit.cover,
                              ),
                            ),
                          ],
                        ),
                        GestureDetector(
                          child: Container(
                            color: Colors.black.withOpacity(0.6),
                            height: 100,
                            width: constraints.maxWidth / 3,
                            child: const Center(
                                child: Text(
                              '+16',
                              style: TextStyle(
                                color: Colors.white,
                                fontSize: Sizes.TEXT_SIZE_20,
                                fontWeight: FontWeight.bold,
                              ),
                            )),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
              ],
            ),
            // BackButton
            GestureDetector(
              onTap: () => Navigator.pop(context),
              child: Padding(
                padding: EdgeInsets.symmetric(
                  horizontal: constraints.maxWidth * .05,
                  vertical: constraints.maxWidth * .02,
                ),
                child: CircleAvatar(
                  backgroundColor: Colors.grey.withOpacity(.5),
                  child: const Icon(
                    CupertinoIcons.back,
                    color: Colors.white,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  ),
);
2uluyalo

2uluyalo1#

下面的黄线表示它的父级缺少材料。你可以用任何材料 Package 小部件,如卡片,材料,脚手架...

Hero(
     tag: productLink,
       child: Material(
         child: Stack(

相关问题