Flutter基础控件之SizedBox

SizedBox

SizedBox是一个固定尺寸的盒子,一般用来作为间隔。

class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SizedBox(
          width: 100,
          height: 100,
          child: Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10.0),
              color: Colors.green,
            ),
            child: Icon(Icons.ac_unit, color: Colors.white),
          ),
        ),
        SizedBox(
          height: 20.0,
        ),
        Icon(Icons.person, size: 80, color: Colors.red),
        Icon(Icons.edit, size: 80, color: Colors.red),
        Icon(Icons.poll, size: 80, color: Colors.red),
      ],
    );
  }
}

效果

SizedBox

你可能感兴趣的:(Flutter基础控件之SizedBox)