From 80a9242b9aa4b2b1187b37cceb2dd897a7ce2bd0 Mon Sep 17 00:00:00 2001 From: "23028876916@qq.com" Date: Thu, 14 Jan 2021 10:12:26 +0800 Subject: [PATCH] =?UTF-8?q?0114=20=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=91=98=E8=83=8C=E6=99=AF=E5=9B=BE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mine_header/mine_header_container.dart | 27 ++- .../mine_header/model/mine_header_model.dart | 162 +++++++++--------- 2 files changed, 109 insertions(+), 80 deletions(-) diff --git a/lib/widgets/mine/mine_header/mine_header_container.dart b/lib/widgets/mine/mine_header/mine_header_container.dart index dd6b3a2..467dd14 100644 --- a/lib/widgets/mine/mine_header/mine_header_container.dart +++ b/lib/widgets/mine/mine_header/mine_header_container.dart @@ -42,6 +42,19 @@ class _MineHeaderContainerState extends State { @override Widget build(BuildContext context) { var width = MediaQuery.of(context).size.width; + BoxDecoration boxDecoration; + if (widget.staticModel.lvBgType == "image") { + boxDecoration = BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: NetworkImage( + widget.staticModel.lvBgImage, + )), + borderRadius: BorderRadius.circular(9)); + } else { + boxDecoration = + BoxDecoration(color: HexColor.fromHex(widget.staticModel.bgColor), borderRadius: BorderRadius.circular(9)); + } return StreamBuilder( stream: _bloc.outData, builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -93,9 +106,17 @@ class _MineHeaderContainerState extends State { height: 18, margin: EdgeInsets.only(left: 6), padding: EdgeInsets.only(left: 6, right: 6), - decoration: BoxDecoration( - color: HexColor.fromHex(widget.staticModel.bgColor), - borderRadius: BorderRadius.circular(9)), + decoration: boxDecoration, + // BoxDecoration( + // image: DecorationImage( + // fit: BoxFit.fitWidth, + // image: NetworkImage( + // widget.staticModel.lvBgImage, + // + // )), + // // color: HexColor.fromHex(widget.staticModel.bgColor), + // // borderRadius: BorderRadius.circular(9) + // ), child: Row( children: [ Container( diff --git a/lib/widgets/mine/mine_header/model/mine_header_model.dart b/lib/widgets/mine/mine_header/model/mine_header_model.dart index 3c9a5b6..3153479 100644 --- a/lib/widgets/mine/mine_header/model/mine_header_model.dart +++ b/lib/widgets/mine/mine_header/model/mine_header_model.dart @@ -1,128 +1,136 @@ class MineHeaderModel { - String assistColor; - String bgColor; - String bgImage; - String bottomLeftRadius; - String bottomRightRadius; - String coypeIcon; + String name; String desc; - String invitedCodeColor; + String moduleType; + String moduleKey; + String isTopMargin; String isLeftRightMargin; String isShow; - String isTopMargin; + String topMargin; String leftRightMargin; - String loginName; - String loginNameHelpText; + String topLeftRadius; + String topRightRadius; + String bottomLeftRadius; + String bottomRightRadius; + String bgColor; + String themeType; + String themeColor; + String assistColor; + String bgImage; + String lvBgType; + String lvBgColor; String lvBgImage; String lvNameColor; - String moduleKey; - String moduleType; - String name; + String invitedCodeColor; + String coypeIcon; + String loginName; + String loginNameHelpText; String nonLginAvatar; + String userNameColor; int requiredLogin; int requiredTaobaoAuth; String skipIdentifier; - String themeColor; - String themeType; - String topLeftRadius; - String topMargin; - String topRightRadius; - String userNameColor; MineHeaderModel( - {this.assistColor, - this.bgColor, - this.bgImage, - this.bottomLeftRadius, - this.bottomRightRadius, - this.coypeIcon, + {this.name, this.desc, - this.invitedCodeColor, + this.moduleType, + this.moduleKey, + this.isTopMargin, this.isLeftRightMargin, this.isShow, - this.isTopMargin, + this.topMargin, this.leftRightMargin, - this.loginName, - this.loginNameHelpText, + this.topLeftRadius, + this.topRightRadius, + this.bottomLeftRadius, + this.bottomRightRadius, + this.bgColor, + this.themeType, + this.themeColor, + this.assistColor, + this.bgImage, + this.lvBgType, + this.lvBgColor, this.lvBgImage, this.lvNameColor, - this.moduleKey, - this.moduleType, - this.name, + this.invitedCodeColor, + this.coypeIcon, + this.loginName, + this.loginNameHelpText, this.nonLginAvatar, + this.userNameColor, this.requiredLogin, this.requiredTaobaoAuth, - this.skipIdentifier, - this.themeColor, - this.themeType, - this.topLeftRadius, - this.topMargin, - this.topRightRadius, - this.userNameColor}); + this.skipIdentifier}); MineHeaderModel.fromJson(Map json) { - assistColor = json['assist_color']; - bgColor = json['bg_color']; - bgImage = json['bg_image']; - bottomLeftRadius = json['bottom_left_radius']; - bottomRightRadius = json['bottom_right_radius']; - coypeIcon = json['coype_icon']; + name = json['name']; desc = json['desc']; - invitedCodeColor = json['invited_code_color']; + moduleType = json['module_type']; + moduleKey = json['module_key']; + isTopMargin = json['is_top_margin']; isLeftRightMargin = json['is_left_right_margin']; isShow = json['is_show']; - isTopMargin = json['is_top_margin']; + topMargin = json['top_margin']; leftRightMargin = json['left_right_margin']; - loginName = json['login_name']; - loginNameHelpText = json['login_name_help_text']; + topLeftRadius = json['top_left_radius']; + topRightRadius = json['top_right_radius']; + bottomLeftRadius = json['bottom_left_radius']; + bottomRightRadius = json['bottom_right_radius']; + bgColor = json['bg_color']; + themeType = json['theme_type']; + themeColor = json['theme_color']; + assistColor = json['assist_color']; + bgImage = json['bg_image']; + lvBgType = json['lv_bg_type']; + lvBgColor = json['lv_bg_color']; lvBgImage = json['lv_bg_image']; lvNameColor = json['lv_name_color']; - moduleKey = json['module_key']; - moduleType = json['module_type']; - name = json['name']; + invitedCodeColor = json['invited_code_color']; + coypeIcon = json['coype_icon']; + loginName = json['login_name']; + loginNameHelpText = json['login_name_help_text']; nonLginAvatar = json['non_lgin_avatar']; + userNameColor = json['user_name_color']; requiredLogin = json['required_login']; requiredTaobaoAuth = json['required_taobao_auth']; skipIdentifier = json['skip_identifier']; - themeColor = json['theme_color']; - themeType = json['theme_type']; - topLeftRadius = json['top_left_radius']; - topMargin = json['top_margin']; - topRightRadius = json['top_right_radius']; - userNameColor = json['user_name_color']; } Map toJson() { final Map data = new Map(); - data['assist_color'] = this.assistColor; - data['bg_color'] = this.bgColor; - data['bg_image'] = this.bgImage; - data['bottom_left_radius'] = this.bottomLeftRadius; - data['bottom_right_radius'] = this.bottomRightRadius; - data['coype_icon'] = this.coypeIcon; + data['name'] = this.name; data['desc'] = this.desc; - data['invited_code_color'] = this.invitedCodeColor; + data['module_type'] = this.moduleType; + data['module_key'] = this.moduleKey; + data['is_top_margin'] = this.isTopMargin; data['is_left_right_margin'] = this.isLeftRightMargin; data['is_show'] = this.isShow; - data['is_top_margin'] = this.isTopMargin; + data['top_margin'] = this.topMargin; data['left_right_margin'] = this.leftRightMargin; - data['login_name'] = this.loginName; - data['login_name_help_text'] = this.loginNameHelpText; + data['top_left_radius'] = this.topLeftRadius; + data['top_right_radius'] = this.topRightRadius; + data['bottom_left_radius'] = this.bottomLeftRadius; + data['bottom_right_radius'] = this.bottomRightRadius; + data['bg_color'] = this.bgColor; + data['theme_type'] = this.themeType; + data['theme_color'] = this.themeColor; + data['assist_color'] = this.assistColor; + data['bg_image'] = this.bgImage; + data['lv_bg_type'] = this.lvBgType; + data['lv_bg_color'] = this.lvBgColor; data['lv_bg_image'] = this.lvBgImage; data['lv_name_color'] = this.lvNameColor; - data['module_key'] = this.moduleKey; - data['module_type'] = this.moduleType; - data['name'] = this.name; + data['invited_code_color'] = this.invitedCodeColor; + data['coype_icon'] = this.coypeIcon; + data['login_name'] = this.loginName; + data['login_name_help_text'] = this.loginNameHelpText; data['non_lgin_avatar'] = this.nonLginAvatar; + data['user_name_color'] = this.userNameColor; data['required_login'] = this.requiredLogin; data['required_taobao_auth'] = this.requiredTaobaoAuth; data['skip_identifier'] = this.skipIdentifier; - data['theme_color'] = this.themeColor; - data['theme_type'] = this.themeType; - data['top_left_radius'] = this.topLeftRadius; - data['top_margin'] = this.topMargin; - data['top_right_radius'] = this.topRightRadius; - data['user_name_color'] = this.userNameColor; return data; } }