SizedOverflowBox(控制大小和超出父view的盒子布局)
SizedOverflowBox主要的布局行为有两点:
- 尺寸部分。通过将自身的固定尺寸,传递给child,来达到控制child尺寸的目的;
- 超出部分。可以突破父节点尺寸的限制,超出部分也可以被渲染显示,与OverflowBox类似。
-属性
const SizedOverflowBox({
Key key,
@required this.size,//固定尺寸
this.alignment = Alignment.center//对齐方式,
Widget child,
})
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'TableView',
theme: new ThemeData(
primaryColor: Colors.green,
),
home: new Scaffold(
appBar: new AppBar(
title: new Text('首页'),
),
body: new Container(
color: Colors.green,
alignment: Alignment.topRight,
width: 200.0,
height