I was working on onboarding screen of my flutter project (I am still beginner and still learning), there is a scroll indicator on onboarding screens which changes according to page change so I checked internet and found that I can use some packages but they were confusing so I tried implementing it by myself, not sure that its the right implementation: PageView.builder( itemCount: OnboardingItmes().items.length, controller: pageController, onPageChanged: (value) { setState(() { scrollIndex = value; }); }, itemBuilder: (context, index) => ... ) And using a row to display that indicator, Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.only(right: 5.0), child: Container( height: 15, width: scrollIndex == 0 ? 40 : 20, decoration: BoxDecoration( color: scrollIndex == 0 ? Colors.blue : Colors.grey.withOpacity(0.5), borderRadius: BorderRadius.circular(15), ), ), ), Padding( padding: const EdgeInsets.only(right: 5.0), child: Container( height: 15, width: scrollIndex == 1 ? 40 : 20, decoration: BoxDecoration( color: scrollIndex == 1 ? Colors.blue : Colors.grey.withOpacity(0.5), borderRadius: BorderRadius.circular(15), ), ), ), Padding( padding: const EdgeInsets.only(right: 5.0), child: Container( height: 15, width: scrollIndex == 2 ? 40 : 20, decoration: BoxDecoration( color: scrollIndex == 2 ? Colors.blue : Colors.grey.withOpacity(0.5), borderRadius: BorderRadius.circular(15), ), ), ), ], ) Is it okay? or there are some better ways? Continue reading...