MotionLoader.liquid constructor

MotionLoader.liquid({
  1. Key? key,
  2. required MotionLiquidStyle style,
  3. Color? color,
  4. double size = 50.0,
})

Liquid Theme Category: Contains 3 advanced fluid dynamics simulation styles.

Implementation

factory MotionLoader.liquid({
  Key? key,
  required MotionLiquidStyle style,
  Color? color,
  double size = 50.0,
}) {
  return MotionLoader._internal(
    key: key,
    color: color,
    size: size,
    builder: (context) {
      final activeColor = color ?? Theme.of(context).primaryColor;
      switch (style) {
        case MotionLiquidStyle.lavaLamp:
          return MotionLavaLampLoader(
            color: activeColor,
            size: size,
          );
        case MotionLiquidStyle.waterDrop:
          return MotionWaterRippleLoader(
            color: activeColor,
            size: size,
          );
        case MotionLiquidStyle.inkSpread:
          return MotionInkSpreadLoader(
            color: activeColor,
            size: size,
          );
      }
    },
  );
}