Wrapper for animations
package to abstract away transitions and just use the widget as an animated switcher.
Includes a switcher for image providers, to support gapless decoding & gapless switching, idle children and animated gifs.
Check Flutter Firestore for real usage.
Widget list;
switch (listStatus) {
case ListStatus.loading:
list = KeyedSubtree(
key: ObjectKey(listStatus),
child: CircularProgressIndicator(),
);
break;
case ListStatus.empty:
list = KeyedSubtree(
key: ObjectKey(listStatus),
child: Text('Nothing here'),
);
break;
case ListStatus.paginated:
list = KeyedSubtree(
key: ObjectKey(listStatus),
child: ListView(...),
);
break;
}
return FancySwitcher.vertical(
child: list,
);
return SwitchingImage(
imageProvider: NetworkImage(...),
idleChild: CircularProgressIndicator(),
);