本文最后更新于 2024年8月19日 下午
SingleChildScrollView类似于Android中的ScrollView,它只能接收一个子组件,定义如下:
1 2 3 4 5 6 7 8 9
| SingleChildScrollView({ this.scrollDirection = Axis.vertical, this.reverse = false, this.padding, bool primary, this.physics, this.controller, this.child, })
|
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Widget build(BuildContext context) { String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; return Scrollbar( child: SingleChildScrollView( padding: const EdgeInsets.all(16.0), child: Center( child: Column( children: str .split("") .map((c) => Text( c, textScaleFactor: 2.0, )) .toList(), ), ), )); }
|