MotionLoader.nature constructor

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

Nature Theme Category: fireflies, tornadoes, volcanoes, sways & eclipses.

Implementation

factory MotionLoader.nature({
  Key? key,
  required MotionNatureStyle 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 MotionNatureStyle.firefly:
          return MotionFireflyLoader(
            color: activeColor,
            size: size,
          );
        case MotionNatureStyle.tornado:
          return MotionTornadoLoader(
            color: activeColor,
            size: size,
          );
        case MotionNatureStyle.volcano:
          return MotionVolcanoLoader(
            color: activeColor,
            size: size,
          );
        case MotionNatureStyle.leafWind:
          return MotionLeafWindLoader(
            color: activeColor,
            size: size,
          );
        case MotionNatureStyle.solarEclipse:
          return MotionSolarEclipseLoader(
            color: activeColor,
            size: size,
          );
      }
    },
  );
}