Fácil de usar esta biblioteca para criar um widget de imagem de rede, você pode criar layouts diferentes de acordo com o erro/carregamento, também configurar o delegado de cache da imagem.
ok_image : ^0.4.0 import "package:ok_image/ok_image.dart" ; import "package:ok_image/ok_image.dart" ;
createWidget (){
return OKImage (
url : "https://ws1.sinaimg.cn/large/844036b9ly1fxfo76hzd4j20zk0nc48i.jpg" ,
width : 200 ,
height : 200 ,
timeout : Duration (seconds : 20 ),
fit : fit,
);
}url: image net url
width: width
height: height
fit: show BoxFit
followRedirects: whether image redirection is allowed.
loadingWidget: display on loading
errorWidget: display when image load error / timeout.
retry: retry to load image count.
timeout: timeout duration.
onErrorTap: when loadErrorWidget show ,onTap it.
cacheDelegate: you can use the param to delegate loadImageExperimental: assinaturas, valores de retorno, parâmetros e outras informações podem ser modificados no futuro.
onLoadStateChanged: will be call on the load state changed. Edit OKImage.buildErrorWidget para configurar o OkImage Error GlobalWidget.
Edit OKImage.buildLoadingWidget para configurar o carregamento global do OKIMAGE.
sob o BSD 3:
Apache 2.0:
Obrigado ao código aberto.
Se você estiver usando versões mais antigas dessas bibliotecas de código aberto, que causam incompatibilidade, atualize o seu. Se for incompatível comigo, entre em contato comigo e eu atualizarei o número da versão quando apropriado.