animateListBorderGlow method

Widget animateListBorderGlow({
  1. required int index,
  2. int intervalMs = 90,
  3. int durationMs = 1000,
  4. Color? color,
  5. double borderRadius = 12.0,
  6. bool animate = true,
})
  1. Border Glow (Rounded)

Implementation

Widget animateListBorderGlow({
  required int index,
  int intervalMs = 90,
  int durationMs = 1000,
  Color? color,
  double borderRadius = 12.0,
  bool animate = true,
}) {
  if (!animate) return this;
  final int delay = _getDelay(index, intervalMs);
  final Color borderColor = color ?? Colors.cyanAccent;

  return this
      .animate(delay: delay.ms)
      .fadeIn(duration: 400.ms)
      .shimmer(
          duration: durationMs.ms,
          color: borderColor.withValues(alpha: 0.3),
          angle: 45)
      .custom(
        begin: 0,
        end: 1,
        duration: (durationMs / 2).toInt().ms,
        curve: Curves.easeInOut,
        builder: (context, value, child) {
          return Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(borderRadius),
              boxShadow: [
                BoxShadow(
                  color: borderColor.withValues(alpha: value * 0.4),
                  blurRadius: value * 12,
                  spreadRadius: value * 1,
                ),
              ],
            ),
            child: child,
          );
        },
      )
      .then(delay: 0.ms)
      .custom(
        begin: 1,
        end: 0,
        duration: (durationMs / 2).toInt().ms,
        builder: (context, value, child) {
          return Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(borderRadius),
              boxShadow: [
                BoxShadow(
                  color: borderColor.withValues(alpha: value * 0.4),
                  blurRadius: value * 12,
                  spreadRadius: value * 1,
                ),
              ],
            ),
            child: child,
          );
        },
      );
}