在主容器边界上,我可以将一个容器放在另一个小容器上吗?

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

Can I Make A Container On One Another Small Container at main container border?

问题

我想创建这种类型的用户界面,是否可以不使用 Stack?

英文:

Like This Type

I Want to make this type of UI and it's possible without using Stack?

答案1

得分: 1

SizedBox(
  width: MediaQuery.of(context).size.width,
  height: MediaQuery.of(context).size.height / 4,
  child: Padding(
    padding: EdgeInsets.symmetric(horizontal: 8, vertical: 5),
    child: Stack(alignment: Alignment.bottomCenter, children: [
      Container(
        margin: EdgeInsets.only(bottom: 5),
        decoration: BoxDecoration(
            color: Colors.blueGrey,
            borderRadius: BorderRadius.circular(20)),
      ),
      Container(
        height: 15,
        width: MediaQuery.of(context).size.width / 4,
        decoration: BoxDecoration(
            color: Colors.black,
            borderRadius: BorderRadius.circular(20)),
      )
    ]),
  ),
)
英文:
 SizedBox(
              width: MediaQuery.of(context).size.width,
              height: MediaQuery.of(context).size.height / 4,
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 8, vertical: 5),
                child: Stack(alignment: Alignment.bottomCenter, children: [
                  Container(
                    margin: EdgeInsets.only(bottom: 5),
                    decoration: BoxDecoration(
                        color: Colors.blueGrey,
                        borderRadius: BorderRadius.circular(20)),
                  ),
                  Container(
                    height: 15,
                    width: MediaQuery.of(context).size.width / 4,
                    decoration: BoxDecoration(
                        color: Colors.black,
                        borderRadius: BorderRadius.circular(20)),
                  )
                ]),
              ),
            )

your problem is fixed now , use this code

</details>



huangapple
  • 本文由 发表于 2023年2月24日 13:52:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75553045.html
匿名

发表评论

匿名网友

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

确定