build method

  1. @override
Widget build(
  1. int currentPage,
  2. double pageDelta,
  3. int itemCount
)
override

Builder method returning the slide indicator widget. The method accepts the currentPage on which the carousel currently resides, the pageDelta or the difference between the current page and its resting position and itemCount which is the total number of items.

Implementation

@override
Widget build(int currentPage, double pageDelta, int itemCount) {
  return Container(
    key: key,
    alignment: slideIndicatorOptions.alignment,
    padding: slideIndicatorOptions.padding,
    color: Colors.transparent,
    child: Container(
      decoration: slideIndicatorOptions.enableHalo
          ? slideIndicatorOptions.haloDecoration
          : null,
      padding: slideIndicatorOptions.enableHalo
          ? slideIndicatorOptions.haloPadding
          : null,
      child: SizedBox(
        width: itemCount * slideIndicatorOptions.itemSpacing,
        height: slideIndicatorOptions.indicatorRadius * 2,
        child: CustomPaint(
          painter: CircularStaticIndicatorPainter(
            currentIndicatorColor:
                slideIndicatorOptions.currentIndicatorColor,
            indicatorBackgroundColor:
                slideIndicatorOptions.indicatorBackgroundColor,
            currentPage: currentPage,
            pageDelta: pageDelta,
            itemCount: itemCount,
            radius: slideIndicatorOptions.indicatorRadius,
            enableAnimation: slideIndicatorOptions.enableAnimation,
            indicatorBorderColor: slideIndicatorOptions.indicatorBorderColor,
            borderWidth: slideIndicatorOptions.indicatorBorderWidth,
          ),
        ),
      ),
    ),
  );
}