美文网首页
5.4 容器类组件 - Container

5.4 容器类组件 - Container

作者: 努力生活的西鱼 | 来源:发表于2023-10-16 11:07 被阅读0次
Container({
  super.key,
  this.alignment,
  this.padding,
  this.color,
  this.decoration,
  this.foregroundDecoration,
  double? width,
  double? height,
  BoxConstraints? constraints,
  this.margin,
  this.transform,
  this.transformAlignment,
  this.child,
  this.clipBehavior = Clip.none,
})
1. 卡片示例
@override
Widget build(BuildContext context) {
  return Container(
    constraints: const BoxConstraints.tightFor(width: 200,height: 150),
    margin: const EdgeInsets.only(top: 50,left: 120),
    decoration: const BoxDecoration(
      gradient: RadialGradient(
        colors: [Colors.red,Colors.orange],
        center: Alignment.topLeft,
        radius: .98
      ),
      boxShadow: [
        BoxShadow(
          color: Colors.black54,
          offset: Offset(2, 2),
          blurRadius: 4
        )
      ]
    ),
    transform: Matrix4.rotationZ(.2),
    alignment: Alignment.center,
    child: const Text(
      "5.20",
      style: TextStyle(
        color: Colors.white,
        fontSize: 40
      ),
    ),
  );
}

相关文章

网友评论

      本文标题:5.4 容器类组件 - Container

      本文链接:https://www.haomeiwen.com/subject/glvxidtx.html