networkFirstThenLocal static method
优先网络图片,带缓存
- 然后是本地asset图片
Implementation
static Widget networkFirstThenLocal(
String? path, {
BoxFit? fit = BoxFit.contain,
Widget? defaultWidget,
}) {
if (path?.startsWith("http") == true) {
return cacheNetWork(path, fit: fit, defaultWidget: defaultWidget);
} else {
if (FFEmpty.stringIsEmpty(path)) {
return defaultWidget ?? Container();
}
return asset(path!, fit: fit);
}
}