getUILoadingType function
Implementation
UILoadingType? getUILoadingType(Object? type) {
if (type == null) return null;
if (type is UILoadingType) return type;
var typeStr = type.toString().trim().toLowerCase();
switch (typeStr) {
case 'ring':
return UILoadingType.ring;
// Note: `typeStr` is lower-cased, so it can't be matched as `dualRing`:
case 'dualring':
case 'dual-ring':
case 'dual_ring':
return UILoadingType.dualRing;
case 'roller':
return UILoadingType.roller;
case 'spinner':
return UILoadingType.spinner;
case 'ripple':
return UILoadingType.ripple;
case 'blocks':
return UILoadingType.blocks;
case 'ellipsis':
return UILoadingType.ellipsis;
default:
return null;
}
}