0

I am new to flutter development and I am using the carousel_slider (https://pub.dev/packages/carousel_slider) widget in my flutter application. Simply this widget is used within the list builder so there are multiple carousels within a single page.

I need to set the height of the carousel auto-adjusting according to its child content. But when I removed the height value from the parameter it set the default height. Because of that widget content shows a "Bottom overflow" error. Any ideas or suggestions to sort out this issue?

This is the widget I'm trying within list view

Widget build(BuildContext context) {
    return Expanded(
      child: Column(
        children: [
          CarouselSlider(
              options: CarouselOptions(
                viewportFraction: 1,
                onPageChanged: (index, reason) {
                  setState(() {
                    widget.pageIndex = index;
                  });
                },
              ),
              items: [
                Column(
                  children: [
                    Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Padding(
                            padding: const EdgeInsets.only(left: 10, right: 10),
                            child: Container(
                            //some text content here
                            ),
                          Padding(
                            padding: const EdgeInsets.only(right: 10),
                            child: Container(
                            //some text content here
                            ),
                          ),
                        ]),
                  ],
                ),
                Image.network(
                  widget.article!.imageUrl.toString(),
                )
              ]),
          CarouselIndicator(
            count: 2,
            index: widget.pageIndex,
          ),
        ],
      ),
    );
  }

0 Answers0