Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container 绘制漂亮的盒子 #47

Open
gaowei1012 opened this issue Oct 13, 2020 · 1 comment
Open

Container 绘制漂亮的盒子 #47

gaowei1012 opened this issue Oct 13, 2020 · 1 comment

Comments

@gaowei1012
Copy link
Owner

body: Container(
        child: GestureDetector(
          onTap: _handleTap,
          child: Container(
            width: 200.0,
            height: 200.0,
            margin: EdgeInsets.all(100),
            padding: EdgeInsets.all(10),
            alignment: Alignment.center,
            decoration: BoxDecoration(
              color: _active ? Colors.cyan : Colors.yellow,
              gradient: RadialGradient(

                  /// 背景渐变
                  colors: [Colors.red, Colors.yellow],
                  center: Alignment.center,

                  /// center
                  radius: .98),
              boxShadow: [
                /// 背景阴影
                BoxShadow(
                    color: Colors.black45,
                    offset: Offset(2.0, 1.0),
                    blurRadius: 4.0)
              ],
            ),

            /// 卡片倾斜
            transform: Matrix4.rotationZ(.3),

            child: Text(
              _active ? active : inactive,
              style: TextStyle(fontSize: 32, color: Colors.black),
            ),
          ),
        ),
      ),
@gaowei1012
Copy link
Owner Author

gaowei1012 commented Oct 13, 2020

常用属性

Container({
  this.alignment, // 内容对其方式
  this.padding, //容器内补白,属于decoration的装饰范围
  Color color, // 背景色
  Decoration decoration, // 背景装饰
  Decoration foregroundDecoration, //前景装饰
  double width,//容器的宽度
  double height, //容器的高度
  BoxConstraints constraints, //容器大小的限制条件
  this.margin,//容器外补白,不属于decoration的装饰范围
  this.transform, //变换
  this.child, // child
})

@gaowei1012 gaowei1012 changed the title Conrainer 绘制漂亮的盒子 Container 绘制漂亮的盒子 Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant