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.
    );
  }
}

 

posted @ 2019-10-30 09:06  野猿新一  阅读(52)  评论(0编辑  收藏  举报