LoadAsset的期间屏幕会出现红色的信息
来源:12-5 首页大接口Dao层实现和调用-2【Dao层设计】
weixin_慕沐9405561
2020-04-15
LoadAsset的期间屏幕会出现红色的信息,但是过一会就好了
//这里面存放的是几个页面的网络布局URl和图片,颜色等等
import 'dart:convert';
import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:helloworld/NetWork/service_url.dart';
class NavigationDao {
static Future<Map<String, dynamic>> fetch() async {
Response respone = await DiaoManager.getInstance().dio.get(
"/init/Navigator",
options: Options(responseType: ResponseType.json));
if (respone.statusCode == 200) {
Map jsonmap = respone.data;
Autogenerated auto = Autogenerated.fromJson(jsonmap);
;
return auto.toJson();
}
}
}
class Autogenerated {
FloaingButton floaingButton;
List<Navigation> navigation;
Autogenerated({this.floaingButton, this.navigation});
Autogenerated.fromJson(Map<String, dynamic> json) {
floaingButton = json['FloaingButton'] != null
? new FloaingButton.fromJson(json['FloaingButton'])
: null;
if (json['Navigation'] != null) {
navigation = new List<Navigation>();
json['Navigation'].forEach((v) {
navigation.add(new Navigation.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.floaingButton != null) {
data['FloaingButton'] = this.floaingButton.toJson();
}
if (this.navigation != null) {
data['Navigation'] = this.navigation.map((v) => v.toJson()).toList();
}
return data;
}
}
class FloaingButton {
String floaingNormalImage;
int floaingNormalSize;
Color floaingNormalColor;
String floaingClickedImage;
int floaingClickedSize;
Color floaingClickedColor;
List<SmallButton> smallButton;
FloaingButton(
{this.floaingNormalImage,
this.floaingNormalSize,
this.floaingClickedImage,
this.floaingClickedSize,
this.smallButton});
FloaingButton.fromJson(Map<String, dynamic> json) {
floaingNormalImage = json['FloaingNormalImage'];
floaingNormalSize = json['FloaingNormalSize'];
floaingNormalColor = Color(int.parse(json["FloaingNormalColor"]));
floaingClickedImage = json['FloaingClickedImage'];
floaingClickedSize = json['FloaingClickedSize'];
floaingClickedColor = Color(int.parse(json["FloaingClickedColor"]));
if (json['SmallButton'] != null) {
smallButton = new List<SmallButton>();
json['SmallButton'].forEach((v) {
smallButton.add(new SmallButton.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['FloaingNormalImage'] = this.floaingNormalImage;
data['FloaingNormalSize'] = this.floaingNormalSize;
data['FloaingNormalColor'] = this.floaingNormalColor;
data['FloaingClickedImage'] = this.floaingClickedImage;
data['FloaingClickedSize'] = this.floaingClickedSize;
data['FloaingClickedColor'] = this.floaingClickedColor;
if (this.smallButton != null) {
data['SmallButton'] = this.smallButton.map((v) => v.toJson()).toList();
}
return data;
}
}
class SmallButton {
String text;
String imageUrl;
int imageSize;
SmallButton({this.text, this.imageUrl, this.imageSize});
SmallButton.fromJson(Map<String, dynamic> json) {
text = json['Text'];
imageUrl = json['ImageUrl'];
imageSize = json['ImageSize'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Text'] = this.text;
data['ImageUrl'] = this.imageUrl;
data['ImageSize'] = this.imageSize;
return data;
}
}
class Navigation {
String name;
Color fontColor;
int fontSize;
String iamgeUrl;
Color imageColor;
int imageSize;
Navigation(
{this.name,
this.fontColor,
this.fontSize,
this.iamgeUrl,
this.imageColor,
this.imageSize});
Navigation.fromJson(Map<String, dynamic> json) {
name = json['name'];
fontColor = Color(int.parse(json['fontColor']));
fontSize = json['fontSize'];
iamgeUrl = json['iamgeUrl'];
imageColor = Color(int.parse(json['imageColor']));
imageSize = json['imageSize'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['fontColor'] = this.fontColor;
data['fontSize'] = this.fontSize;
data['iamgeUrl'] = this.iamgeUrl;
data['imageColor'] = this.imageColor;
data['imageSize'] = this.imageSize;
return data;
}
}
写回答
1回答
-
CrazyCodeBoy
2020-04-15
看下控制台有没有相关log输出呢
012020-04-16
相似问题