在flutter web中,我们可以调整窗口大小。如何确保在窗口小于内容大小时出现滚动条,就像在普通网页中一样?
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: LayoutBuilder(
builder: (BuildContext context, BoxConstraints viewportConstraints) {
return SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: viewportConstraints.maxHeight,
minWidth: viewportConstraints.maxWidth,
),
child: Row(
children: [
buildNavigatorDrawer(),
Expanded(
child: Container(
color: Colors.black12,
padding: const EdgeInsets.all(16.0),
child: MainContainer(),
),
),
],
),
),
);
},
),
);
}