flutter singlechildscrollview column code example

Example 1: listview inside singlechildscrollview flutter scrolling

SingleChildScrollView
   Column
     Container
        ListView(
                shrinkWrap: true,
                physics: NeverScrollableScrollPhysics(),
                //...
                )

Example 2: singlechildscrollview not working inside column

Simply wrap your "SingleChildScrollView" widget with "Expanded" widget and it will work...
:)

Widget build(BuildContext context) =>
Scaffold(
  body: Column(
    children: <Widget>[
      Container(...),
      // Here... Wrap your "SingleChildScrollView" with "Expanded"
      Expanded(
        child: SingleChildScrollView(
          child: Container(...),
        ),
      ),
    ],
  ),
);

Example 3: listview inside singlechildscrollview flutter scrolling

ListView(
   primary: false,
   shrinkWrap: true,
),

Example 4: single child scrollview inside column flutter

Widget build(BuildContext context) =>
Scaffold(
  body: Column(
    children: <Widget>[
      Container(
        height: 100.0,
        color: Colors.blue,
      ),
      Expanded(
        child: SingleChildScrollView(
          child: Container(
            color: Colors.red,
            padding: EdgeInsets.all(20.0),
            child: Column(
              children: <Widget>[
                Text('Red container should be scrollable'),
                Container(
                  width: double.infinity,
                  height: 700.0,
                  padding: EdgeInsets.all(10.0),
                  color: Colors.white.withOpacity(0.7),
                  child: Text('I will have a column here'),
                )
              ],
            ),
          ),
        ),
      ),
    ],
  ),
);

Tags:

Dart Example