asSkeleton method
Widget
asSkeleton({
- bool enabled = true,
- bool leaf = false,
- Widget? replacement,
- bool unite = false,
- AsyncSnapshot? snapshot,
Implementation
Widget asSkeleton(
{bool enabled = true,
bool leaf = false,
Widget? replacement,
bool unite = false,
AsyncSnapshot? snapshot}) {
if (snapshot != null) {
enabled = !snapshot.hasData;
}
if (this is Avatar || this is Image) {
// https://github.com/Milad-Akarie/skeletonizer/issues/17
return Skeleton.leaf(
enabled: enabled,
child: this,
);
}
if (unite) {
return Skeleton.unite(
unite: enabled,
child: this,
);
}
if (replacement != null) {
return Skeleton.replace(
replace: enabled,
child: replacement,
);
}
if (leaf) {
return Skeleton.leaf(
enabled: enabled,
child: this,
);
}
return Skeletonizer(
enabled: enabled,
child: this,
);
}