ready method

FFill ready(
  1. FFillType type
)

Set of FFill ready to be used

Implementation

FFill ready(final FFillType type) {
  if (type == FFillType.none) {
    return FFill(
      levels: const [
        FFillElement(
          color: '000000',
          stop: 0,
        ),
      ],
      type: type,
    );
  } else if (type == FFillType.radialGradient) {
    return FFill(
      levels: const [
        FFillElement(
          color: 'ffffff',
          stop: 0,
        ),
        FFillElement(
          color: '000000',
          stop: 1,
        ),
      ],
      center: Alignment.center,
      type: type,
      radius: 1,
    );
  } else if (type == FFillType.linearGradient) {
    return FFill(
      levels: const [
        FFillElement(
          color: 'ffffff',
          stop: 0,
        ),
        FFillElement(
          color: '000000',
          stop: 1,
        ),
      ],
      begin: Alignment.topCenter,
      end: Alignment.bottomCenter,
      type: type,
    );
  } else if (type == FFillType.solid) {
    return FFill(
      levels: const [
        FFillElement(
          color: '000000',
          stop: 0,
        ),
      ],
      type: type,
    );
  } else {
    return FFill(
      levels: const [
        FFillElement(
          color: 'https://source.unsplash.com/random',
          stop: 0,
        ),
      ],
      boxFit: const FBoxFit(value: BoxFit.cover),
      type: type,
    );
  }
}