flutter SingleChildScrollView就像是IOS里面的ScrollView

import 'package:flutter/material.dart';

void main() {
  runApp( MaterialApp(
    title: 'Flutter gesture',
    home: LearnListView(),
  ));
}
class LearnListView extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return new _LearnListView();
  }
}
class _LearnListView extends State<StatefulWidget>{

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'SingleChildScrollView Demo',
      home: new Scaffold(
        appBar: AppBar(
          title: new Text('SingleChildScrollView Demo'),
        ),
        body: new SingleChildScrollView(
          physics: BouncingScrollPhysics(),
          child: new Center(
            child: new Column(
              children: <Widget>[
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.blue,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.yellow,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.pink,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.blue,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.yellow,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.pink,
                ),
                Container(
                   300.0,
                  height: 200.0,
                  color: Colors.blue,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

 

原文地址:https://www.cnblogs.com/gaozhang12345/p/11959183.html