applyShadow method
void
applyShadow(
- String style
)
Implementation
void applyShadow(String style) {
try {
final metric = style.split("-")[1];
if (metric == "none") {
boxDecoration = boxDecoration.copyWith(boxShadow: []);
} else if (metric == "sm") {
boxDecoration = boxDecoration.copyWith(boxShadow: [
BoxShadow(
offset: const Offset(0, 1),
blurRadius: 2,
spreadRadius: 0,
color: Colors.black.withOpacity(0.3),
),
]);
} else if (metric == "md") {
boxDecoration = boxDecoration.copyWith(boxShadow: [
BoxShadow(
offset: const Offset(0, 4),
blurRadius: 6,
spreadRadius: -1,
color: Colors.black.withOpacity(0.6),
),
BoxShadow(
offset: const Offset(0, 2),
blurRadius: 4,
spreadRadius: -2,
color: Colors.black.withOpacity(0.6),
),
]);
} else if (metric == "lg") {
boxDecoration = boxDecoration.copyWith(boxShadow: [
BoxShadow(
offset: const Offset(0, 10),
blurRadius: 15,
spreadRadius: -3,
color: Colors.black.withOpacity(0.6),
),
BoxShadow(
offset: const Offset(0, 4),
blurRadius: 6,
spreadRadius: -3,
color: Colors.black.withOpacity(0.6))
]);
} else if (metric == "xl") {
boxDecoration = boxDecoration.copyWith(boxShadow: [
BoxShadow(
offset: const Offset(0, 20),
blurRadius: 25,
spreadRadius: -5,
color: Colors.black.withOpacity(0.6),
),
BoxShadow(
offset: const Offset(0, 8),
blurRadius: 10,
spreadRadius: -6,
color: Colors.black.withOpacity(0.6))
]);
} else if (metric == "2xl") {
boxDecoration = boxDecoration.copyWith(boxShadow: [
BoxShadow(
offset: const Offset(0, 25),
blurRadius: 50,
spreadRadius: -12,
color: Colors.black.withOpacity(0.75),
),
]);
}
} on RangeError catch (_) {
return;
}
}