customBoxDecoration function

Decoration customBoxDecoration({
  1. required Animation animation,
  2. bool isRectBox = false,
  3. bool isDarkMode = false,
  4. bool isPurplishMode = false,
  5. bool hasCustomColors = false,
  6. List<Color> colors = defaultColors,
  7. AlignmentGeometry beginAlign = Alignment.topLeft,
  8. AlignmentGeometry endAlign = Alignment.bottomRight,
})

Implementation

Decoration customBoxDecoration({
  required Animation animation,
  bool isRectBox = false,
  bool isDarkMode = false,
  bool isPurplishMode = false,
  bool hasCustomColors = false,
  List<Color> colors = defaultColors,
  AlignmentGeometry beginAlign = Alignment.topLeft,
  AlignmentGeometry endAlign = Alignment.bottomRight,
}) {
  return BoxDecoration(
      borderRadius: BorderRadius.circular(aTheme.radius),
      shape: isRectBox ? BoxShape.rectangle : BoxShape.circle,
      gradient: LinearGradient(
          begin: beginAlign,
          end: endAlign,
          colors: hasCustomColors
              ? colors.map((color) {
            return color;
          }).toList()
              : [
            isPurplishMode
                ? Color(0xFF8D71A9)
                : isDarkMode
                ? Color(0xFF1D1D1D)
                : Color.fromRGBO(0, 0, 0, 0.1),
            isPurplishMode
                ? Color(0xFF36265A)
                : isDarkMode
                ? Color(0XFF3C4042)
                : Color(0x44CCCCCC),
            isPurplishMode
                ? Color(0xFF8D71A9)
                : isDarkMode
                ? Color(0xFF1D1D1D)
                : Color.fromRGBO(0, 0, 0, 0.1),
          ],
          stops: [animation.value - 2, animation.value, animation.value + 1]));
}