在Flutter中容器边缘的图像

huangapple go评论53阅读模式
英文:

Image on the edge of container in flutter

问题

将图像放置在Flutter容器的边缘。如图所示:

在Flutter中容器边缘的图像

英文:

I want to put the Image on the edge of the container in flutter

As in shown in image

在Flutter中容器边缘的图像

答案1

得分: 0

使用一个堆栈小部件,其中堆栈的子部件将是包含容器和图像的定位小部件。

英文:

Use a stack widget where the children of the stack would be the container and the image wrapped in a positioned widget.

答案2

得分: 0

以下是您要翻译的内容:

[![演示][1]][1]

Stack(
  clipBehavior: Clip.none,
  children: [
    Container(
      height: 200,
      decoration: BoxDecoration(
        color: Colors.grey.shade400,
        borderRadius: BorderRadius.circular(30),
      ),
    ),
    Positioned(
      top: 135,
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 8.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Image.network(
              "https://pngimg.com/uploads/mercedes/mercedes_PNG80135.png",
              height: 125,
            ),

            const SizedBox(width: 30,),

            FloatingActionButton(
              onPressed: (){},
              backgroundColor: Colors.white,
              child: const Icon(Icons.arrow_forward,color: Colors.black,),
            ),
          ],
        ),
      ),
    )
  ],
),

[1]: https://i.stack.imgur.com/CIguk.png
英文:

在Flutter中容器边缘的图像

Stack(
          clipBehavior: Clip.none,
          children: [
            Container(
              height: 200,
              decoration: BoxDecoration(
                color: Colors.grey.shade400,
                borderRadius: BorderRadius.circular(30),
              ),
            ),
            Positioned(
              top: 135,
              child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 8.0),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Image.network(
                      "https://pngimg.com/uploads/mercedes/mercedes_PNG80135.png",
                      height: 125,
                    ),

                    const SizedBox(width: 30,),

                    FloatingActionButton(
                      onPressed: (){},
                      backgroundColor: Colors.white,
                      child: const Icon(Icons.arrow_forward,color: Colors.black,),
                    ),
                  ],
                ),
              ),
            )
          ],
        ),

huangapple
  • 本文由 发表于 2023年5月14日 20:21:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247453.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定