关注 https://github.com/jiangkang/flutter-system 了解更多Flutter相关的知识
不能进行网络请求的APP不是一个真的APP,Flutter目前在网络请求上还没有非常可靠的开源库(没有令人满意的),暂时用http来实现一下简单的网络请求吧。
效果图
数据模型
/// Model:图片列表响应
class ImageResponse {
final int code;
final String message;
final List<Map<String, dynamic>> result;
ImageResponse(this.code, this.message, this.result);
factory ImageResponse.fromJson(Map<String, dynamic> json) => ImageResponse(
json["code"],
json["message"],
List<Map<String, dynamic>>.from(json["result"]));
}
/// Model:图片数据
class ImageBean {
final String img;
final String publishedAt;
ImageBean({this.img, this.publishedAt});
factory ImageBean.fr