flutter appbar listview builder code example

Example 1: flutter listview builder

List<String> litems = ["1","2","Third","4"];
body: new ListView.builder
  (
    itemCount: litems.length,
    itemBuilder: (BuildContext ctxt, int index) {
     return new Text(litems[index]);
    }
  )

Example 2: how to make a shrinkable action bar in fluttur

Scaffold(
	body: CustomScrollView(
    	slivers: <Widget>[
        	SliverAppBar(
            	expandedHeight : 200.0,
            	floating : false,
            	pinned : true,
            	flexibleSpace : FlexibleSpaceBar(
            	//This exactly likeyour AppBar
            		title: "foo",
                	background: "Whatever you want",
            	),
           	),
            SliverFillRemaining(
            	child: //This is exactly like the body which we have for scaffold
                Center(),
            ),
            
        ],
    ),
)

Tags:

Misc Example