Scrollbar is not visible when wrapping listView Builder with SingleChildScrollView or ListView

441 views Asked by At

**> Here is my code. it contains a ListView builder which is wrapped with

RawScrollBar widget and they both wrapped with SingleChildScrollView Widget. I want a show ScrollBar in ListView.Builder**

 Scaffold(
      backgroundColor: kPrimaryColor,
      body: SafeArea(
        child: SizedBox(
          height: kGetSize(context).height,
          child: Column(
            children: [
              const SizedBox(
                height: 16,
              ),
              const Center(
                child: UserLevelDetailsContainer(),
              ),
              Expanded(
                child: Padding(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
                  **child: SingleChildScrollView(
                    physics: const ScrollPhysics(),
                    controller: _scrollController,
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                    
                          Text(
                              'General Subjects',
                              style: GoogleFonts.openSans(
                                  fontWeight: FontWeight.w700,
                                  fontSize: 20,
                                  color: const Color(0xfff3c304)),
                            ),
                            
                        const SizedBox(
                          height: 8,
                        ),
                        RawScrollbar(
                          thumbVisibility: true,
                          interactive: true,
                          thumbColor: Colors.black,
                          controller: _scrollController,
                          radius: const Radius.circular(60),
                          thickness: 6,
                          child: ListView.builder(
                            controller: _scrollController,
                            physics: const NeverScrollableScrollPhysics(),
                            itemCount: SubjectDetail.listOfSubjects.length,
                            shrinkWrap: true,
                            itemBuilder: (context, index) {
                              return SizedBox(
                                width: 344,
                                height: 96,
                                child: Card(
                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(12.0),
                                  ),
                                  child: ListTile(
                                    contentPadding: const EdgeInsets.symmetric(
                                        horizontal: 24, vertical: 8),
                                    title: Padding(
                                      padding: const EdgeInsets.only(bottom: 4),
                                      child: Text(
                                        SubjectDetail
                                            .listOfSubjects[index].name,
                                        style: GoogleFonts.openSans(
                                            fontWeight: FontWeight.w700,
                                            fontSize: 15),
                                      ),
                                    ),
                                    subtitle: Text(
                                      SubjectDetail
                                          .listOfSubjects[index].description,
                                      style: GoogleFonts.openSans(
                                          fontWeight: FontWeight.w400,
                                          fontSize: 10),
                                    ),
                                    trailing: Image.asset(SubjectDetail
                                        .listOfSubjects[index].imageUrl),
                                  ),
                                ),
                              );
                            },                          
                          ),
                        ),**
                        const SizedBox(
                          height: 8,
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              'General Subjects',
                              style: GoogleFonts.openSans(
                                  fontWeight: FontWeight.w700,
                                  fontSize: 20,
                                  color: const Color(0xfff3c304)),
                            ),
                            Text(
                              '*select one subject',
                              style: GoogleFonts.openSans(
                                  fontWeight: FontWeight.w300,
                                  fontSize: 14,
                                  color: const Color(0xfff3c304)),
                            )
                          ],
                        ),
                      ],
                    ),
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );

I have given same ScrollController object to ListView builder, RawScrollBar and SingleChildScollView widget.Altough I had given different ScrollController objects to them

0

There are 0 answers