Flutter SingleChildScrollView使用
竖直滚动
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: SingleChildScrollView(
child: Text('Hello World\n'*100),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
水平滚动
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text('Hello World! '*100),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}