build method

  1. @override
Widget build(
  1. BuildContext context,
  2. SwiperPluginConfig config
)
override

Implementation

@override
Widget build(BuildContext context, SwiperPluginConfig config) {
  int itemCount = config.itemCount;
  if (itemCount <= 1) {
    return Container();
  }

  ThemeData themeData = Theme.of(context);
  Color activeColor = this.activeColor ?? themeData.primaryColor;
  Color color = this.color ?? themeData.scaffoldBackgroundColor;

  if (Axis.vertical == config.scrollDirection) {
    return Column(
      key: key,
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        Text(
          "${config.activeIndex + 1}",
          style: TextStyle(color: activeColor, fontSize: activeFontSize),
        ),
        Text(
          "/",
          style: TextStyle(color: color, fontSize: fontSize),
        ),
        Text(
          "$itemCount",
          style: TextStyle(color: color, fontSize: fontSize),
        )
      ],
    );
  } else {
    return Row(
      key: key,
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        Text(
          "${config.activeIndex + 1}",
          style: TextStyle(color: activeColor, fontSize: activeFontSize),
        ),
        Text(
          " / $itemCount",
          style: TextStyle(color: color, fontSize: fontSize),
        )
      ],
    );
  }
}