flutter add widgets on top and bottom to a listview

You can achieve this by using listview inside list view, below is sample code please check

enter image description here

 body: ListView(
    children: <Widget>[
      Container(
        height: 40,
        color: Colors.deepOrange,
        child: Center(
          child: Text(
            'Header',
            style: TextStyle(color: Colors.white, fontSize: 16),
          ),
        ),
      ),
      ListView.builder(
        physics: ScrollPhysics(),
        shrinkWrap: true,
        itemCount: 50,
        itemBuilder: (BuildContext context, int index) {
          return Container(
            color: Colors.lime,
            height: 60,
            child: Center(
              child: Text(
                'Child $index',
                style: TextStyle(color: Colors.black, fontSize: 16),
              ),
            ),
          );
        },
      ),
      Container(
        height: 40,
        color: Colors.deepOrange,
        child: Center(
          child: Text(
            'Footer',
            style: TextStyle(color: Colors.white, fontSize: 16),
          ),
        ),
      ),
    ],
  ),

body: Container(
  width: MediaQuery.of(context).size.width,
  height: MediaQuery.of(context).size.height,
  child: ListView(
     children: Widget[
       Container(
         width: MediaQuery.of(context).width,
         height: 50,
         alignment: AlignmentDirectional.center
         child: Text("HEADER")
      ),
      for(var i =0;i<providerApp.domains.length;i++)
      Container(
         width: MediaQuery.of(context).width,
         height: 50,
         alignment: AlignmentDirectional.center
         child: Text("Child $i")
      ),
      Container(
         width: MediaQuery.of(context).width,
         height: 50,
         alignment: AlignmentDirectional.center
         child: Text("Footer")
      )
    ]
  )
)

Tags:

Flutter