ZeroSkeletonAvatar constructor

ZeroSkeletonAvatar({
  1. Key? key,
  2. SkeletonAvatarStyle style = const SkeletonAvatarStyle(),
})

Implementation

ZeroSkeletonAvatar({
  Key? key,
  this.style = const SkeletonAvatarStyle(),
}) : super(
        key: key,
        child: Padding(
          padding: style.padding,
          child: LayoutBuilder(
            builder: (context, constraints) {
              return Container(
                width: ((style.randomWidth != null && style.randomWidth!) ||
                        (style.randomWidth == null &&
                            (style.minWidth != null &&
                                style.maxWidth != null)))
                    ? doubleInRange(
                        style.minWidth ??
                            ((style.maxWidth ?? constraints.maxWidth) / 3),
                        style.maxWidth ?? constraints.maxWidth)
                    : style.width,
                height: ((style.randomHeight != null &&
                            style.randomHeight!) ||
                        (style.randomHeight == null &&
                            (style.minHeight != null &&
                                style.maxHeight != null)))
                    ? doubleInRange(
                        style.minHeight ??
                            ((style.maxHeight ?? constraints.maxHeight) / 3),
                        style.maxHeight ?? constraints.maxHeight)
                    : style.height,
                decoration: BoxDecoration(
                  color: context.theme.scaffoldBackgroundColor,
                  shape: style.shape,
                  borderRadius: style.shape != BoxShape.circle
                      ? style.borderRadius
                      : null,
                ),
              );
            },
          ),
        ),
      );