首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >你怎么能把圆形的化身叠加在一起呢?

你怎么能把圆形的化身叠加在一起呢?
EN

Stack Overflow用户
提问于 2022-11-06 21:22:45
回答 2查看 28关注 0票数 0

这是我第一次面对这个问题,我对如何做到这一点没有选择余地。我读了很多论坛,但在任何地方都找不到这样的东西。我需要像画中那样做,我怎么做呢?

这是一个如何得到结果的示例:在这里输入图像描述

代码语言:javascript
运行
复制
    Padding(padding: const  EdgeInsets.only(top: 15), 
     child: Row(
      children: const  [
                                        
      CircleAvatar(
 backgroundColor: Colors.white,
    radius: 18,
  child: CircleAvatar(
  radius: 16,
  backgroundImage: AssetImage('lib/assets/avatar-410658-028235png.png'),
     ),
       ),
                                   
   CircleAvatar(
    backgroundColor: Colors.white,
      radius: 18,
      child: CircleAvatar(
   radius: 16,
    backgroundImage: AssetImage('lib/assets/avatar-410658-028235png.png'),
       ),
      ),

      CircleAvatar(
 backgroundColor: Colors.white,
   radius: 18,
 child: CircleAvatar(
     radius: 16,
  backgroundImage: AssetImage('lib/assets/avatar-410658-028235png.png'),
  ),
   ),
    
    
     CircleAvatar(
    backgroundColor: Colors.white,
   radius: 20,
   child:  CircleAvatar(
  radius: 18, 
    backgroundColor: Colors.black,
  child: Text('28', style: TextStyle(fontSize: 12.5, color: Colors.white ),),
   )
     ),
     
    
     Padding(padding: EdgeInsets.only(left: 70)   ,
     child: Text('6 Hours Ago', style: TextStyle(fontSize: 12.5),)
      ),
        ],
           ),
             ),
EN

回答 2

Stack Overflow用户

发布于 2022-11-06 22:43:40

使用堆栈小部件。在这里读到:

https://api.flutter.dev/flutter/widgets/Stack-class.html

票数 0
EN

Stack Overflow用户

发布于 2022-11-07 09:28:44

You need to wrap your CircleAvatar widget with align widget and set the widthFactor parameter to a double for example.

代码语言:javascript
运行
复制
   Padding(
          padding: const EdgeInsets.only(top: 15),
          child: Row(
            children: const [
              Align(
                widthFactor: .7,
                child: CircleAvatar(
                  backgroundColor: Colors.white,
                  radius: 18,
                  child: CircleAvatar(
                    radius: 16,
                    backgroundImage:
                        AssetImage('lib/assets/avatar-410658-028235png.png'),
                  ),
                ),
              ),
              Align(
                widthFactor: .7,
                child: CircleAvatar(
                  backgroundColor: Colors.white,
                  radius: 18,
                  child: CircleAvatar(
                    radius: 16,
                    backgroundImage:
                        AssetImage('lib/assets/avatar-410658-028235png.png'),
                  ),
                ),
              ),
              Align(
                widthFactor: .7,
                child: CircleAvatar(
                  backgroundColor: Colors.white,
                  radius: 18,
                  child: CircleAvatar(
                    radius: 16,
                    backgroundImage:
                        AssetImage('lib/assets/avatar-410658-028235png.png'),
                  ),
                ),
              ),
              Align(
                widthFactor: .7,
                child: CircleAvatar(
                    backgroundColor: Colors.white,
                    radius: 20,
                    child: CircleAvatar(
                      radius: 18,
                      backgroundColor: Colors.black,
                      child: Text(
                        '28',
                        style: TextStyle(fontSize: 12.5, color: Colors.white),
                      ),
                    )),
              ),
              Padding(
                  padding: EdgeInsets.only(left: 70),
                  child: Text(
                    '6 Hours Ago',
                    style: TextStyle(fontSize: 12.5),
                  )),
            ],
          ),
        ),
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74339843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档