Search code examples
flutterdartflutter-dependenciesflutter-animation

Scroll physics with listview in Custom area - flutter


I want to set, user can scroll and see the admins --- inside red marked container (look at the picture).

  • "Admins" Text don't want to scroll
  • Listtiles in ListView.Builder only scroll inside red area marked in picture (red area = Container)

my try here :

              Container(
                    height: 300,
                    child: Column(
                      children: [
                        const CustomText(
                              align: TextAlign.start,
                              size: 20,
                              text: "Admins",
                              textColor: Colors.white,
                              fontWeight: FontWeight.w500,
                            ),
                        ListView.builder(
                          physics: AlwaysScrollableScrollPhysics(),
                          scrollDirection: Axis.vertical,
                          itemCount: itlength,
                          shrinkWrap: true,
                          itemBuilder: (context, index) {
                            return Container(
                              padding: const EdgeInsets.symmetric(
                                  horizontal: 5, vertical: 10),
                              child: ListTile(
                                title: Text(name),
                                subtitle:
                                    Text(sub),
                              ),
                            );
                          },
                        ),
                      ],
                    ),
                  )

enter image description here


Solution

  • Wrapping your ListView with Expanded to take all the available space will fix it but make sure that the parent of the container is Column not a Scrolling widget.