notification static method

Widget notification({
  1. required String title,
  2. required String message,
  3. IconData? icon,
  4. VoidCallback? onTap,
  5. VoidCallback? onDismiss,
  6. GlassType type = GlassType.crystal,
})

Glass notification banner

Implementation

static Widget notification({
  required String title,
  required String message,
  IconData? icon,
  VoidCallback? onTap,
  VoidCallback? onDismiss,
  GlassType type = GlassType.crystal,
}) {
  return GlassContainer(
    type: type,
    margin: EdgeInsets.all(16.w),
    onTap: onTap,
    child: Padding(
      padding: EdgeInsets.all(16.w),
      child: Row(
        children: [
          if (icon != null) ...[
            Icon(icon, color: Colors.white, size: 24.sp),
            SizedBox(width: 12.w),
          ],
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                Text(
                  title,
                  style: AppTextThemes.bodyMedium(
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                SizedBox(height: 4.h),
                Text(
                  message,
                  style: AppTextThemes.bodySmall(color: Colors.white70),
                ),
              ],
            ),
          ),
          if (onDismiss != null) ...[
            SizedBox(width: 12.w),
            GestureDetector(
              onTap: onDismiss,
              child: Container(
                padding: EdgeInsets.all(4.w),
                decoration: BoxDecoration(
                  color: Colors.white.withOpacity(0.2),
                  shape: BoxShape.circle,
                ),
                child: Icon(
                  Icons.close,
                  color: Colors.white,
                  size: 16.sp,
                ),
              ),
            ),
          ],
        ],
      ),
    ),
  );
}