listview flutter scrollable code example

Example 1: how to make a column scrollable in flutter

return new Container(
  child: new SingleChildScrollView(
    child: new Column(
      children: <Widget>[
        _showChild1(),
        _showChild2(),
        ...
        _showChildN()
      ]
    )
  )
);

Example 2: make listview not scrollable flutter

ListView(
   physics: NeverScrollableScrollPhysics(), // <-- this will disable scroll
   shrinkWrap: true,
   children: [],
 ),

Example 3: make scaffold scrollable flutter


 Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: Text('News'),
    ),
    body: SingleChildScrollView(  // <-- wrap this around
      child: Column(
        children: <Widget>[
        ],
      ),
    ));
  }

Tags:

Dart Example