flutter 如何制作这样自定义容器:

s3fp2yjn  于 2023-01-31  发布在  Flutter
关注(0)|答案(2)|浏览(167)

enter image description here我需要创建此自定义容器
我尝试了更多,使它的边界半径,但我不能这样做,我希望堆栈溢出做

kqlmhetl

kqlmhetl1#

可以使用DecoratedBox设置每个角的边界半径:

Center(
    child: DecoratedBox(
      decoration: BoxDecoration(
      color: Colors.deepOrangeAccent.shade200,
      borderRadius: const BorderRadius.only(
      bottomLeft: Radius.circular(100),
      bottomRight: Radius.circular(4),
      topLeft: Radius.circular(8),
      topRight: Radius.circular(8),
      ),
      ),
      child: const SizedBox(
      height: 100,
      width: 100,
      ),
    ),
    ),

mbyulnm0

mbyulnm02#

请尝试以下代码:

Container(
  height: 100.0,
  width: 100.0,
  decoration: BoxDecoration(
    color: Colors.orange[100],
    borderRadius: const BorderRadius.only(
      topLeft: Radius.circular(15.0),
      topRight: Radius.circular(15.0),
      bottomLeft: Radius.circular(100.0),
      bottomRight: Radius.circular(5.0),
    ),
  ),
),

相关问题