build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Build method to render the indicator.

Implementation

@override
Widget build(BuildContext context) {
  return SizedBox(
    width: MediaQuery.of(context).size.width,
    height: 20,
    child: AnimatedBuilder(
        animation: controller,
        builder: (context, _) {
          return Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              const Expanded(child: SizedBox()),
              for (var i = 0; i < len; i++)
                Container(
                  width: (i == currentPage)
                      ? config.currentPageSize
                      : config.otherPagesSize,
                  height: (i == currentPage)
                      ? config.currentPageSize
                      : config.otherPagesSize,
                  margin: const EdgeInsets.symmetric(horizontal: 4),
                  decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      color: (i == currentPage)
                          ? config.currentPageColor //
                          : config.otherPagesColor), //),
                ),
              const Expanded(child: SizedBox())
            ],
          );
        }),
  );
}