I am using smooth_page_indicator, but the Animated smooth indicator is not responding, I am pretty sure i am missing something here. i have a feeling it has something to do with how i created my list. in the application, however, the switcher shows that i have 3 main items. but still, as always, assistance would be really appreciated.

class ExploreCollections extends StatefulWidget {
  const ExploreCollections({Key? key}) : super(key: key);

  @override
  State<ExploreCollections> createState() => _ExploreCollectionsState();
}

class _ExploreCollectionsState extends State<ExploreCollections> {
  int _activeIndex = 0;
  final List<Widget> _images = [
    Stack(
      children: [
        Image.asset('assets/images/image 10.png'),
        Padding(
          padding: const EdgeInsets.only(left: 55.0, top: 230),
          child: Text(
            'Luxury \n   Fashion \n &Accessories'.toUpperCase(),
            style: TextStyle(
                fontFamily: 'Bodoni',
                fontSize: 40,
                fontWeight: FontWeight.w500,
                color: Colors.grey.shade700
            ),
          ),
        ),
        Padding(
          padding: const EdgeInsets.only(top: 250.0),
          child: Center(
            child:SvgPicture.asset('assets/iconImages/Button.svg') ,
          ),
        ),
      ],
    ),
    Stack(
      children: [
        Image.asset('assets/images/leeloo.jpeg'),
      ],
    ),
    Stack(
      children: [
        Image.asset('assets/images/ayaka.jpeg'),
      ],
    ),
  ];
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Stack(
        children: [
          CarouselSlider.builder(
            options: CarouselOptions(
              viewportFraction: 1,
              aspectRatio: 1.8,
              height: MediaQuery.of(context).size.height,
              autoPlay: false,
              initialPage: 0,
              enableInfiniteScroll: false,
              enlargeCenterPage: true,
              onPageChanged: (index, reason){
                _activeIndex = index;
              }
            ),
            itemCount: _images.length,
            itemBuilder: (BuildContext context, int index, int realIndex) {
              return _images[index];
            },
          ),
          Center(
            child: buildIndicator(),
          ),
        ],
      ),
    );
  }
  Widget buildIndicator(){
    return AnimatedSmoothIndicator(
        activeIndex: _activeIndex,
        count: _images.length
    );
  }
}


Solution 1: Yeasin Sheikh

Call setState to update the UI

onPageChanged: (index, reason) {
  _activeIndex = index;
  setState(() {});
}),