PinIndicator constructor

PinIndicator({
  1. required int length,
  2. required int currentLength,
  3. required bool isError,
  4. required bool isSuccess,
  5. PinIndicatorAnimationController? controller,
  6. BoxDecoration? errorDecoration,
  7. BoxDecoration? successDecoration,
  8. BoxDecoration? inputDecoration,
  9. BoxDecoration? defaultDecoration,
  10. double spacing = 24.0,
  11. double itemSize = 14.0,
  12. Widget? loadingCollapseAnimationChild,
  13. Widget? successCollapseAnimationChild,
  14. Key? key,
})

Simple decorated Pin Indicator widget.

Implementation

PinIndicator({
  required this.length,
  required this.currentLength,
  required this.isError,
  required this.isSuccess,
  this.controller,
  BoxDecoration? errorDecoration,
  BoxDecoration? successDecoration,
  BoxDecoration? inputDecoration,
  BoxDecoration? defaultDecoration,
  this.spacing = 24.0,
  this.itemSize = 14.0,
  this.loadingCollapseAnimationChild,
  this.successCollapseAnimationChild,
  super.key,
})  : assert(length >= currentLength),
      assert(length > 3),
      assert(spacing > 0),
      assert(itemSize > 0),
      assert(!isError || !isSuccess),
      defaultItemBuilder = ((_) => PinIndicatorItem(
            size: itemSize,
            decoration: defaultDecoration ??
                const BoxDecoration(
                    shape: BoxShape.circle, color: Colors.black26),
          )),
      errorItemBuilder = ((_) => PinIndicatorItem(
            size: itemSize,
            decoration: errorDecoration ??
                const BoxDecoration(
                    shape: BoxShape.circle, color: Colors.red),
          )),
      successItemBuilder = ((_) => PinIndicatorItem(
            size: itemSize,
            decoration: successDecoration ??
                const BoxDecoration(
                    shape: BoxShape.circle, color: Colors.green),
          )),
      inputItemBuilder = ((_) => PinIndicatorItem(
          size: itemSize,
          decoration: inputDecoration ??
              const BoxDecoration(
                  shape: BoxShape.circle, color: Colors.blue)));