@@ -9,13 +9,16 @@ class TeamDetailsRepository { | |||
TeamDetailsDataModel _dataModel; | |||
/// 初始化数据 | |||
Future<dynamic> fetchNetData(final Map<String, dynamic> data) async { | |||
Future<TeamDetailsDataModel> fetchNetData(final Map<String, dynamic> data) async { | |||
try { | |||
if (!EmptyUtil.isEmpty(data)) { | |||
String fansId = data['uid']; | |||
if (!EmptyUtil.isEmpty(fansId)) { | |||
var result = await NetUtil.post('/api/v1/user/fan/$fansId', method: NetMethod.GET); | |||
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) {} | |||
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | |||
_dataModel = TeamDetailsDataModel.fromJson(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||
return _dataModel; | |||
} | |||
} | |||
} | |||
} catch (e, s) { | |||
@@ -1 +1,124 @@ | |||
class TeamDetailsDataModel{} | |||
import 'package:zhiying_base_widget/widgets/team/fans_list/model/team_fans_list_model.dart'; | |||
import 'package:meta/meta.dart'; | |||
@immutable | |||
class TeamDetailsDataModel { | |||
List<TeamDetailsDataModelDashBoard> dash_board; | |||
TeamFansListItemModel info; | |||
TeamFansListItemModel referrer; | |||
TeamDetailsDataModel({this.dash_board, this.info, this.referrer}); | |||
factory TeamDetailsDataModel.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsDataModel( | |||
dash_board: json['dash_board'] != null ? (json['dash_board'] as List).map((i) => TeamDetailsDataModelDashBoard.fromJson(i)).toList() : null, | |||
info: json['info'] != null ? TeamFansListItemModel.fromJson(json['info']) : null, | |||
referrer: json['referrer'] != null ? TeamFansListItemModel.fromJson(json['referrer']) : null, | |||
); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
if (this.dash_board != null) { | |||
data['dash_board'] = this.dash_board.map((v) => v.toJson()).toList(); | |||
} | |||
if (this.info != null) { | |||
data['info'] = this.info.toJson(); | |||
} | |||
if (this.referrer != null) { | |||
data['referrer'] = this.referrer.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
// class TeamDetailsDataModelReferrer { | |||
// String referrer_avatar; | |||
// String referrer_invite_code; | |||
// String referrer_phone; | |||
// String referrer_username; | |||
// String referrer_wechat; | |||
// String uid; | |||
// | |||
// TeamDetailsDataModelReferrer({this.referrer_avatar, this.referrer_invite_code, this.referrer_phone, this.referrer_username, this.referrer_wechat, this.uid}); | |||
// | |||
// // 获取模糊手机号码 | |||
// get blurMobile => !EmptyUtil.isEmpty(referrer_phone) | |||
// ? referrer_phone.length == 11 ? '${referrer_phone.substring(0, 3)}****${referrer_phone.substring(7, referrer_phone.length)}' : referrer_phone | |||
// : referrer_phone; | |||
// | |||
// // 获取模糊昵称 | |||
// get blurUserName => | |||
// !EmptyUtil.isEmpty(referrer_username) ? referrer_username.length > 6 ? '${referrer_username.substring(0, 3)}****${referrer_username.substring(referrer_username.length - 3, referrer_username.length)}' : referrer_username : referrer_username; | |||
// | |||
// // 获取模糊微信 | |||
// get blurWeChat => !EmptyUtil.isEmpty(referrer_wechat) ? referrer_wechat.length > 6 ? '${referrer_wechat.substring(0, 3)}****${referrer_wechat.substring(referrer_wechat.length - 3, referrer_wechat.length)}' : referrer_wechat : referrer_wechat; | |||
// | |||
// factory TeamDetailsDataModelReferrer.fromJson(Map<String, dynamic> json) { | |||
// return TeamDetailsDataModelReferrer( | |||
// referrer_avatar: json['referrer_avatar'], | |||
// referrer_invite_code: json['referrer_invite_code'], | |||
// referrer_phone: json['referrer_phone'], | |||
// referrer_username: json['referrer_username'], | |||
// referrer_wechat: json['referrer_wechat'], | |||
// uid: json['uid'], | |||
// ); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['referrer_avatar'] = this.referrer_avatar; | |||
// data['referrer_invite_code'] = this.referrer_invite_code; | |||
// data['referrer_phone'] = this.referrer_phone; | |||
// data['referrer_username'] = this.referrer_username; | |||
// data['referrer_wechat'] = this.referrer_wechat; | |||
// data['uid'] = this.uid; | |||
// return data; | |||
// } | |||
// } | |||
class TeamDetailsDataModelDashBoard { | |||
List<TeamDetailsDashBoardItem> list; | |||
String type; | |||
TeamDetailsDataModelDashBoard({this.list, this.type}); | |||
factory TeamDetailsDataModelDashBoard.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsDataModelDashBoard( | |||
list: json['list'] != null ? (json['list'] as List).map((i) => TeamDetailsDashBoardItem.fromJson(i)).toList() : null, | |||
type: json['type'], | |||
); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['type'] = this.type; | |||
if (this.list != null) { | |||
data['list'] = this.list.map((v) => v.toJson()).toList(); | |||
} | |||
return data; | |||
} | |||
} | |||
class TeamDetailsDashBoardItem { | |||
List<String> data_list; | |||
String type; | |||
TeamDetailsDashBoardItem({this.data_list, this.type}); | |||
factory TeamDetailsDashBoardItem.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsDashBoardItem( | |||
data_list: json['data_list'] != null ? new List<String>.from(json['data_list']) : null, | |||
type: json['type'], | |||
); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['type'] = this.type; | |||
if (this.data_list != null) { | |||
data['data_list'] = this.data_list; | |||
} | |||
return data; | |||
} | |||
} |
@@ -1,7 +1,6 @@ | |||
import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart'; | |||
import 'package:meta/meta.dart'; | |||
@immutable | |||
class TeamDetailsStyleModel { | |||
String app_bar_bg_color; | |||
@@ -12,8 +11,10 @@ class TeamDetailsStyleModel { | |||
List<TeamDetailsStyleModelDashbord> dashbord; | |||
List<TeamDetailsStyleModelDashbordItem> dashbord_items; | |||
String dashbord_line_color; | |||
String name_color; | |||
String name_selected_color; | |||
TeamDetailsStyleModelHeaderReferrer header_referrer; | |||
TeamViewItem self_info; | |||
TeamViewItemStyle self_info; | |||
TeamDetailsStyleModel({ | |||
this.app_bar_bg_color, | |||
@@ -26,10 +27,14 @@ class TeamDetailsStyleModel { | |||
this.dashbord_line_color, | |||
this.header_referrer, | |||
this.self_info, | |||
this.name_color, | |||
this.name_selected_color, | |||
}); | |||
factory TeamDetailsStyleModel.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsStyleModel( | |||
name_color: json['name_color'], | |||
name_selected_color: json['name_selected_color'], | |||
app_bar_bg_color: json['app_bar_bg_color'], | |||
app_bar_bg_img: json['app_bar_bg_img'], | |||
app_bar_name: json['app_bar_name'], | |||
@@ -39,7 +44,7 @@ class TeamDetailsStyleModel { | |||
dashbord_items: json['dashbord_items'] != null ? (json['dashbord_items'] as List).map((i) => TeamDetailsStyleModelDashbordItem.fromJson(i)).toList() : null, | |||
dashbord_line_color: json['dashbord_line_color'], | |||
header_referrer: json['header_referrer'] != null ? TeamDetailsStyleModelHeaderReferrer.fromJson(json['header_referrer']) : null, | |||
self_info: json['self_info'] != null ? TeamViewItem.fromJson(json['self_info']) : null, | |||
self_info: json['self_info'] != null ? TeamViewItemStyle.fromJson(json['self_info']) : null, | |||
); | |||
} | |||
@@ -51,6 +56,8 @@ class TeamDetailsStyleModel { | |||
data['app_bar_name_color'] = this.app_bar_name_color; | |||
data['bg_color'] = this.bg_color; | |||
data['dashbord_line_color'] = this.dashbord_line_color; | |||
data['name_selected_color'] = this.name_selected_color; | |||
data['name_color'] = name_color; | |||
if (this.dashbord != null) { | |||
data['dashbord'] = this.dashbord.map((v) => v.toJson()).toList(); | |||
} | |||
@@ -127,47 +134,51 @@ class TeamDetailsStyleModelHeaderReferrer { | |||
String wx_color; | |||
String wx_text; | |||
String wx_value_color; | |||
TeamDetailsStyleModelHeaderReferrer( | |||
{this.bar_color, | |||
this.copy_btn_bg_color, | |||
this.copy_btn_icon, | |||
this.copy_btn_text, | |||
this.copy_btn_text_color, | |||
this.last_login_text, | |||
this.last_login_text_color, | |||
this.last_login_value_color, | |||
this.phone_color, | |||
this.phone_text, | |||
this.title, | |||
this.title_bg_color, | |||
this.title_bg_color_t, | |||
this.title_color, | |||
this.username_color, | |||
this.wx_color, | |||
this.wx_text, | |||
this.wx_value_color}); | |||
String lv_text_color; | |||
TeamDetailsStyleModelHeaderReferrer({ | |||
this.bar_color, | |||
this.copy_btn_bg_color, | |||
this.copy_btn_icon, | |||
this.copy_btn_text, | |||
this.copy_btn_text_color, | |||
this.last_login_text, | |||
this.last_login_text_color, | |||
this.last_login_value_color, | |||
this.phone_color, | |||
this.phone_text, | |||
this.title, | |||
this.title_bg_color, | |||
this.title_bg_color_t, | |||
this.title_color, | |||
this.username_color, | |||
this.wx_color, | |||
this.wx_text, | |||
this.wx_value_color, | |||
this.lv_text_color, | |||
}); | |||
factory TeamDetailsStyleModelHeaderReferrer.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsStyleModelHeaderReferrer( | |||
bar_color: json['bar_color'], | |||
copy_btn_bg_color: json['copy_btn_bg_color'], | |||
copy_btn_icon: json['copy_btn_icon'], | |||
copy_btn_text: json['copy_btn_text'], | |||
copy_btn_text_color: json['copy_btn_text_color'], | |||
last_login_text: json['last_login_text'], | |||
last_login_text_color: json['last_login_text_color'], | |||
last_login_value_color: json['last_login_value_color'], | |||
phone_color: json['phone_color'], | |||
phone_text: json['phone_text'], | |||
title: json['title'], | |||
title_bg_color: json['title_bg_color'], | |||
title_bg_color_t: json['title_bg_color_t'], | |||
title_color: json['title_color'], | |||
username_color: json['username_color'], | |||
wx_color: json['wx_color'], | |||
wx_text: json['wx_text'], | |||
wx_value_color: json['wx_value_color'], | |||
bar_color: json['bar_color'], | |||
copy_btn_bg_color: json['copy_btn_bg_color'], | |||
copy_btn_icon: json['copy_btn_icon'], | |||
copy_btn_text: json['copy_btn_text'], | |||
copy_btn_text_color: json['copy_btn_text_color'], | |||
last_login_text: json['last_login_text'], | |||
last_login_text_color: json['last_login_text_color'], | |||
last_login_value_color: json['last_login_value_color'], | |||
phone_color: json['phone_color'], | |||
phone_text: json['phone_text'], | |||
title: json['title'], | |||
title_bg_color: json['title_bg_color'], | |||
title_bg_color_t: json['title_bg_color_t'], | |||
title_color: json['title_color'], | |||
username_color: json['username_color'], | |||
wx_color: json['wx_color'], | |||
wx_text: json['wx_text'], | |||
wx_value_color: json['wx_value_color'], | |||
lv_text_color: json['lv_text_color'], | |||
); | |||
} | |||
@@ -191,30 +202,25 @@ class TeamDetailsStyleModelHeaderReferrer { | |||
data['wx_color'] = this.wx_color; | |||
data['wx_text'] = this.wx_text; | |||
data['wx_value_color'] = this.wx_value_color; | |||
data['lv_text_color'] = this.lv_text_color; | |||
return data; | |||
} | |||
} | |||
class TeamDetailsStyleModelDashbord { | |||
String name; | |||
String name_color; | |||
String name_selected_color; | |||
TeamDetailsStyleModelDashbord({this.name, this.name_color, this.name_selected_color}); | |||
TeamDetailsStyleModelDashbord({this.name}); | |||
factory TeamDetailsStyleModelDashbord.fromJson(Map<String, dynamic> json) { | |||
return TeamDetailsStyleModelDashbord( | |||
name: json['name'], | |||
name_color: json['name_color'], | |||
name_selected_color: json['name_selected_color'], | |||
); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['name_color'] = this.name_color; | |||
data['name_selected_color'] = this.name_selected_color; | |||
return data; | |||
} | |||
} |
@@ -34,15 +34,50 @@ class _TeamDetailsPage extends StatefulWidget { | |||
} | |||
class _TeamDetailsPageState extends State<_TeamDetailsPage> { | |||
int _selectIndex = 0; | |||
TabController _controller; | |||
@override | |||
void initState() { | |||
super.initState(); | |||
} | |||
void _initTabController(TeamDetailsStyleModel styleModel) { | |||
int length = styleModel?.dashbord?.length ?? 0; | |||
if (null == _controller && length > 0) { | |||
_controller = TabController(length: length, vsync: ScrollableState()); | |||
_controller.addListener(_tabListener); | |||
} | |||
} | |||
void _tabListener() { | |||
if (!_controller.indexIsChanging) { | |||
setState(() { | |||
_selectIndex = _controller.index; | |||
}); | |||
} | |||
} | |||
@override | |||
void dispose() { | |||
_controller?.removeListener(_tabListener); | |||
_controller?.dispose(); | |||
super.dispose(); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
return BlocConsumer<TeamDetailsBloc, TeamDetailsState>( | |||
listener: (context, state) {}, | |||
buildWhen: (prov, current) { | |||
if (current is TeamDetailsErrorState) { | |||
return false; | |||
} | |||
return true; | |||
}, | |||
builder: (context, state) { | |||
if (state is TeamDetailsLoadedState) { | |||
_initTabController(state?.styleModel); | |||
return _getMainWidget(state?.styleModel, state?.dataModel); | |||
} | |||
return _getMainWidget(null, null); | |||
@@ -50,8 +85,6 @@ class _TeamDetailsPageState extends State<_TeamDetailsPage> { | |||
); | |||
} | |||
TabController controller = TabController(length: 2, vsync: ScrollableState()); | |||
/// 主视图 | |||
Widget _getMainWidget(TeamDetailsStyleModel styleModel, TeamDetailsDataModel dataModel) { | |||
return Scaffold( | |||
@@ -60,72 +93,65 @@ class _TeamDetailsPageState extends State<_TeamDetailsPage> { | |||
slivers: <Widget>[ | |||
/// 头部Bar | |||
SliverAppBar( | |||
// expandedHeight: 200.0, | |||
leading: IconButton( | |||
icon: Icon( | |||
Icons.arrow_back_ios, | |||
size: 22, | |||
color: HexColor.fromHex( '#333333'), | |||
), | |||
onPressed: () => Navigator.maybePop(context), | |||
), | |||
backgroundColor: HexColor.fromHex(styleModel?.app_bar_bg_color ?? '#FFFFFF'), | |||
floating: true, | |||
pinned: true, | |||
title: Text( | |||
styleModel?.app_bar_name ?? '用户详情', | |||
style: TextStyle(color: HexColor.fromHex( styleModel?.app_bar_name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 18), | |||
), | |||
centerTitle: true, | |||
elevation: 0, | |||
), | |||
// expandedHeight: 200.0, | |||
leading: IconButton( | |||
icon: Icon( | |||
Icons.arrow_back_ios, | |||
size: 22, | |||
color: HexColor.fromHex('#333333'), | |||
), | |||
onPressed: () => Navigator.maybePop(context)), | |||
backgroundColor: HexColor.fromHex(styleModel?.app_bar_bg_color ?? '#FFFFFF'), | |||
floating: true, | |||
pinned: true, | |||
title: Text(styleModel?.app_bar_name ?? '用户详情', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.app_bar_name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 18)), | |||
centerTitle: true, | |||
elevation: 0), | |||
/// TA的推荐人 | |||
SliverToBoxAdapter( | |||
child: TeamDetailsReferrerWidget(), | |||
), | |||
SliverToBoxAdapter(child: TeamDetailsReferrerWidget(styleModel?.header_referrer, dataModel?.referrer)), | |||
/// 推荐人的信息 | |||
SliverToBoxAdapter( | |||
child: TeamFansItem(null, null), | |||
), | |||
SliverToBoxAdapter(child: TeamFansItem(styleModel?.self_info, dataModel?.info)), | |||
/// 本月数据 & 上个月数据 | |||
SliverToBoxAdapter( | |||
child: Container( | |||
height: 30, | |||
width: double.infinity, | |||
margin: const EdgeInsets.only(left: 50, right: 50, top: 10), | |||
child: TabBar( | |||
labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), | |||
indicatorColor: HexColor.fromHex('#F94B47'), | |||
indicator: MaterialIndicator( | |||
height: 2, bottomRightRadius: 2, bottomLeftRadius: 2, topRightRadius: 2, topLeftRadius: 2, color: HexColor.fromHex('#F94B47'), horizontalPadding: 17), | |||
unselectedLabelStyle: TextStyle(fontSize: 15), | |||
indicatorSize: TabBarIndicatorSize.label, | |||
labelColor: HexColor.fromHex('#000000'), | |||
unselectedLabelColor: HexColor.fromHex('#999999'), | |||
controller: controller, | |||
tabs: <Widget>[ | |||
Text('本月数据'), | |||
Text('上月数据'), | |||
], | |||
child: Visibility( | |||
visible: null != _controller, | |||
child: Container( | |||
height: 30, | |||
width: double.infinity, | |||
margin: const EdgeInsets.only(left: 50, right: 50, top: 10), | |||
child: TabBar( | |||
labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), | |||
indicatorColor: HexColor.fromHex(styleModel?.dashbord_line_color ?? '#F94B47'), | |||
indicator: MaterialIndicator( | |||
height: 2, | |||
bottomRightRadius: 2, | |||
bottomLeftRadius: 2, | |||
topRightRadius: 2, | |||
topLeftRadius: 2, | |||
color: HexColor.fromHex(styleModel?.dashbord_line_color ?? '#F94B47'), | |||
horizontalPadding: 17, | |||
), | |||
unselectedLabelStyle: TextStyle(fontSize: 15), | |||
indicatorSize: TabBarIndicatorSize.label, | |||
labelColor: HexColor.fromHex(styleModel?.name_selected_color ?? '#000000'), | |||
unselectedLabelColor: HexColor.fromHex(styleModel?.name_color ?? '#999999'), | |||
controller: _controller, | |||
tabs: _buildTabs(styleModel), | |||
), | |||
), | |||
), | |||
), | |||
/// 邀请贡献 | |||
SliverToBoxAdapter( | |||
child: TeamDetailsMonthDataWidget(), | |||
), | |||
SliverToBoxAdapter( | |||
child: TeamDetailsMonthDataWidget(), | |||
), | |||
SliverToBoxAdapter( | |||
child: TeamDetailsMonthDataWidget(), | |||
), | |||
SliverToBoxAdapter(child: _buildDataCar(styleModel, dataModel)), | |||
// | |||
// SliverToBoxAdapter( | |||
// child: TeamDetailsMonthDataWidget(), | |||
// ), | |||
SliverPadding(padding: const EdgeInsets.only(bottom: 28)) | |||
], | |||
@@ -133,10 +159,40 @@ class _TeamDetailsPageState extends State<_TeamDetailsPage> { | |||
); | |||
} | |||
/// 推荐人 | |||
/// 推荐人的信息 | |||
/// 本月数据 & 上个月数据 | |||
List<Widget> _buildTabs(TeamDetailsStyleModel styleModel) { | |||
int length = styleModel?.dashbord?.length ?? 0; | |||
List<Widget> widgets = []; | |||
if (length > 0) { | |||
styleModel.dashbord.forEach((element) { | |||
widgets.add(Text(element.name)); | |||
}); | |||
} else { | |||
widgets.add(Text('本月数据')); | |||
widgets.add(Text('上月数据')); | |||
} | |||
return widgets; | |||
} | |||
/// 贡献值自购等 | |||
Widget _buildDataCar(TeamDetailsStyleModel styleModel, TeamDetailsDataModel dataModel) { | |||
List<Widget> widgets = []; | |||
int styleLength = styleModel?.dashbord_items?.length ?? 0; | |||
int dataLength = dataModel?.dash_board?.length ?? 0; | |||
int dataItemLength = dataLength > 0 ? dataModel.dash_board[0]?.list?.length ?? 0 : 0; | |||
if (styleLength > 0) { | |||
// styleModel.dashbord_items.forEach((element) { | |||
// widgets.add(TeamDetailsMonthDataWidget(element, dataLength > 0 ? dataModel?.dash_board[_selectIndex] : null)); | |||
// }); | |||
for (int i = 0; i < styleLength; i++) { | |||
TeamDetailsStyleModelDashbordItem element = styleModel.dashbord_items[i]; | |||
TeamDetailsDashBoardItem dataElement = (dataLength > 0 && dataItemLength > 0 && dataItemLength == styleLength) ? dataModel.dash_board[_selectIndex].list[i] : null; | |||
widgets.add(TeamDetailsMonthDataWidget(element, dataElement)); | |||
} | |||
return Column(children: widgets); | |||
} else { | |||
return Container(); | |||
} | |||
} | |||
} |
@@ -41,7 +41,7 @@ class TeamStyleModel { | |||
String teamViewEmptyImg; | |||
List<TeamViewSortList> teamViewSortList; | |||
List<TeamViewItemTitleList> teamViewItemTitleList; | |||
TeamViewItem teamViewItem; | |||
TeamViewItemStyle teamViewItem; | |||
String headerNoReferrerInputColor; | |||
String headerNoReferrerInputBgColor; | |||
@@ -169,7 +169,7 @@ class TeamStyleModel { | |||
teamViewItemTitleList.add(new TeamViewItemTitleList.fromJson(v)); | |||
}); | |||
} | |||
teamViewItem = json['team_view_item'] != null ? new TeamViewItem.fromJson(json['team_view_item']) : null; | |||
teamViewItem = json['team_view_item'] != null ? new TeamViewItemStyle.fromJson(json['team_view_item']) : null; | |||
headerNoReferrerInputColor = json['header_no_referrer_intput_color']; | |||
headerNoReferrerInputBgColor = json['header_no_referrer_intput_bg_color']; | |||
headerReferrerInvitecodeText = json['header_referrer_invitecode_text']; | |||
@@ -437,7 +437,7 @@ class TeamViewItemTitleList { | |||
} | |||
} | |||
class TeamViewItem extends SkipModel{ | |||
class TeamViewItemStyle extends SkipModel{ | |||
String lvTextColor; | |||
String lvBgColor; | |||
String lvBgImg; | |||
@@ -478,7 +478,7 @@ class TeamViewItem extends SkipModel{ | |||
String monthEarningTextColor; | |||
String monthEarningValueColor; | |||
TeamViewItem( | |||
TeamViewItemStyle( | |||
{this.lvTextColor, | |||
this.lvBgColor, | |||
this.lvBgImg, | |||
@@ -519,7 +519,7 @@ class TeamViewItem extends SkipModel{ | |||
this.monthEarningTextColor, | |||
this.monthEarningValueColor}); | |||
TeamViewItem.fromJson(Map<String, dynamic> json) { | |||
TeamViewItemStyle.fromJson(Map<String, dynamic> json) { | |||
super.fromJson(json); | |||
lvTextColor = json['lv_text_color']; | |||
lvBgColor = json['lv_bg_color']; | |||
@@ -53,7 +53,6 @@ class _TeamPageContainerState extends State<_TeamPageContainer> { | |||
// TabController 监听 | |||
void _tabChangeListener(){ | |||
if (!_controller.indexIsChanging) { | |||
Logger.log('this TabController is ${_controller?.index}'); | |||
Provider.of<TeamPageNotifier>(context, listen: false).updateTabIndex(_controller?.index ?? 0); | |||
} | |||
} | |||
@@ -52,7 +52,7 @@ class TeamFansListItemModel { | |||
// 获取模糊昵称 | |||
get blurUserName => | |||
!EmptyUtil.isEmpty(username) ? username.length > 6 ? '${username.substring(0, 3)}****${username.substring(username.length - 3, phone.length)}' : username : username; | |||
!EmptyUtil.isEmpty(username) ? username.length > 6 ? '${username.substring(0, 3)}****${username.substring(username.length - 3, username.length)}' : username : username; | |||
// 获取模糊微信 | |||
get blurWeChat => !EmptyUtil.isEmpty(wechat) ? wechat.length > 6 ? '${wechat.substring(0, 3)}****${wechat.substring(wechat.length - 3, wechat.length)}' : wechat : wechat; | |||
@@ -1,6 +1,5 @@ | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:zhiying_base_widget/pages/team_details_page/team_details_page.dart'; | |||
import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:zhiying_base_widget/widgets/team/fans_list/model/team_fans_list_model.dart'; | |||
@@ -12,7 +11,7 @@ import 'dart:ui' as ui show PlaceholderAlignment; | |||
/// 我的团队 - 粉丝信息 | |||
/// | |||
class TeamFansItem extends StatefulWidget { | |||
TeamStyleModel styleModel; | |||
TeamViewItemStyle styleModel; | |||
TeamFansListItemModel dataModel; | |||
TeamFansItem(this.styleModel, this.dataModel); | |||
@@ -25,7 +24,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
/// 跳去粉丝详情 | |||
void _openFansItemDetailsPage() { | |||
// Navigator.push(context, CupertinoPageRoute(builder: (_) => TeamDetailsPage(null))); | |||
RouterUtil.route(widget?.styleModel?.teamViewItem, widget?.dataModel?.toJson(), context); | |||
RouterUtil.route(widget?.styleModel, widget?.dataModel?.toJson(), context); | |||
} | |||
/// 复制文字 | |||
@@ -99,7 +98,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
const SizedBox(width: 2.5), | |||
Text( | |||
widget?.dataModel?.levelName ?? '黑钻会员', | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.lvTextColor ?? 'FFFFFF'), fontSize: 8), | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.lvTextColor ?? 'FFFFFF'), fontSize: 8), | |||
), | |||
], | |||
), | |||
@@ -113,10 +112,10 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
alignment: Alignment.center, | |||
padding: const EdgeInsets.only(left: 2.5, right: 2.5, top: 2, bottom: 2), | |||
margin: const EdgeInsets.only(left: 3, right: 3), | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(2.5), color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.directTextBgColor ?? '#FF4242')), | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(2.5), color: HexColor.fromHex(widget?.styleModel?.directTextBgColor ?? '#FF4242')), | |||
child: Text( | |||
widget?.dataModel?.levelType ?? '直', | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.directTextColor ?? '#FFFFFF'), fontSize: 8), | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.directTextColor ?? '#FFFFFF'), fontSize: 8), | |||
), | |||
), | |||
), | |||
@@ -124,7 +123,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
/// 会员名称 | |||
TextSpan( | |||
text: widget?.dataModel?.blurUserName ?? '***', | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.usernameColor ?? '#333333'), fontSize: 12, fontWeight: FontWeight.bold)) | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.usernameColor ?? '#333333'), fontSize: 12, fontWeight: FontWeight.bold)) | |||
]), | |||
), | |||
const SizedBox(height: 2.5), | |||
@@ -135,12 +134,12 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
text: TextSpan(text: '', children: [ | |||
/// 手机号码 | |||
TextSpan( | |||
text: widget?.styleModel?.teamViewItem?.phooneText ?? '手机号:', | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.phoneColor ?? '#333333'), fontSize: 11)), | |||
text: widget?.styleModel?.phooneText ?? '手机号:', | |||
style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.phoneColor ?? '#333333'), fontSize: 11)), | |||
TextSpan( | |||
text: widget?.dataModel?.blurMobile ?? '', | |||
style: TextStyle( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.phoneColor ?? '#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
color: HexColor.fromHex(widget?.styleModel?.phoneColor ?? '#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
/// 复制按钮 | |||
WidgetSpan( | |||
@@ -152,7 +151,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
width: 11, | |||
margin: const EdgeInsets.only(left: 3), | |||
child: CachedNetworkImage( | |||
imageUrl: widget?.styleModel?.teamViewItem?.phoneCopyIcon ?? '', | |||
imageUrl: widget?.styleModel?.phoneCopyIcon ?? '', | |||
), | |||
), | |||
)) | |||
@@ -169,7 +168,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
return Container( | |||
padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarColor ?? '#F7F7F7'), | |||
color: HexColor.fromHex(widget?.styleModel?.infoBarColor ?? '#F7F7F7'), | |||
borderRadius: BorderRadius.circular(5), | |||
), | |||
child: Row( | |||
@@ -180,16 +179,16 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
textAlign: TextAlign.center, | |||
text: TextSpan(text: '', children: [ | |||
TextSpan( | |||
text: widget?.styleModel?.teamViewItem?.infoBarWxText ?? '微信号:', | |||
text: widget?.styleModel?.infoBarWxText ?? '微信号:', | |||
style: TextStyle( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarWxTextColor ?? '#999999'), | |||
color: HexColor.fromHex(widget?.styleModel?.infoBarWxTextColor ?? '#999999'), | |||
fontWeight: FontWeight.bold, | |||
fontSize: 11, | |||
)), | |||
TextSpan( | |||
text: widget?.dataModel?.blurWeChat ?? '', | |||
style: TextStyle( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarWxValueColor ?? '#333333'), | |||
color: HexColor.fromHex(widget?.styleModel?.infoBarWxValueColor ?? '#333333'), | |||
fontWeight: FontWeight.bold, | |||
fontSize: 11, | |||
fontFamily: 'Din', | |||
@@ -205,7 +204,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
padding: const EdgeInsets.only(left: 5.5), | |||
width: 11 + 5.5, | |||
child: CachedNetworkImage( | |||
imageUrl: widget?.styleModel?.teamViewItem?.phoneCopyIcon ?? '', | |||
imageUrl: widget?.styleModel?.phoneCopyIcon ?? '', | |||
)), | |||
)) | |||
]), | |||
@@ -216,15 +215,15 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: widget?.styleModel?.teamViewItem?.infoBarLastLoginText ?? '最近登陆 ', | |||
text: widget?.styleModel?.infoBarLastLoginText ?? '最近登陆 ', | |||
style: TextStyle( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarLastLoginTextColor ?? '#909090'), | |||
color: HexColor.fromHex(widget?.styleModel?.infoBarLastLoginTextColor ?? '#909090'), | |||
fontSize: 11, | |||
)), | |||
TextSpan( | |||
text: widget?.dataModel?.lastLogin ?? '', | |||
style: TextStyle( | |||
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarLastLoginValueColor ?? '#909090'), | |||
color: HexColor.fromHex(widget?.styleModel?.infoBarLastLoginValueColor ?? '#909090'), | |||
fontSize: 11, | |||
fontFamily: 'Din', | |||
package: 'zhiying_base_widget')), | |||
@@ -252,11 +251,11 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
children: <Widget>[ | |||
/// 邀请人数(人) | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.totalInviteText ?? '邀请人数(人)', | |||
textColor: widget?.styleModel?.teamViewItem?.totalInviteTextColor ?? '#333333', | |||
text: widget?.styleModel?.totalInviteText ?? '邀请人数(人)', | |||
textColor: widget?.styleModel?.totalInviteTextColor ?? '#333333', | |||
textSize: 10, | |||
number: widget?.dataModel?.inviteCount ?? '0', | |||
numberColor: widget?.styleModel?.teamViewItem?.totalInviteValueColor ?? '#FF4242', | |||
numberColor: widget?.styleModel?.totalInviteValueColor ?? '#FF4242', | |||
numberSize: 20, | |||
), | |||
const SizedBox(height: 15), | |||
@@ -267,21 +266,21 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
children: <Widget>[ | |||
/// 今日邀请 | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.todayInviteText ?? '今日邀请', | |||
textColor: widget?.styleModel?.teamViewItem?.todayInviteTextColor ?? '#909090', | |||
text: widget?.styleModel?.todayInviteText ?? '今日邀请', | |||
textColor: widget?.styleModel?.todayInviteTextColor ?? '#909090', | |||
textSize: 10, | |||
number: widget?.dataModel?.todayInviteCount ?? '0', | |||
numberColor: widget?.styleModel?.teamViewItem?.todayInviteValueColor ?? '#333333', | |||
numberColor: widget?.styleModel?.todayInviteValueColor ?? '#333333', | |||
numberSize: 15, | |||
), | |||
/// 本月邀请 | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.monthInviteText ?? '本月邀请', | |||
textColor: widget?.styleModel?.teamViewItem?.monthInviteTextColor ?? '#909090', | |||
text: widget?.styleModel?.monthInviteText ?? '本月邀请', | |||
textColor: widget?.styleModel?.monthInviteTextColor ?? '#909090', | |||
textSize: 10, | |||
number: widget?.dataModel?.monthInviteCount ?? '0', | |||
numberColor: widget?.styleModel?.teamViewItem?.monthInviteValueColor ?? '#333333', | |||
numberColor: widget?.styleModel?.monthInviteValueColor ?? '#333333', | |||
numberSize: 15, | |||
), | |||
], | |||
@@ -297,7 +296,7 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
child: VerticalDivider( | |||
width: 0.5, | |||
thickness: 0.5, | |||
color: HexColor.fromHex(widget?.styleModel?.dashbordLineColor ?? '#F7F7F7'), | |||
color: HexColor.fromHex(/*widget?.styleModel?.dashbordLineColor ??*/ '#F7F7F7'), | |||
)), | |||
/// 右边数据 | |||
@@ -309,11 +308,11 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
children: <Widget>[ | |||
/// 累计收益(¥) | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.totalEarningText ?? '累计收益(¥)', | |||
textColor: widget?.styleModel?.teamViewItem?.totalEarningTextColor ?? '#333333', | |||
text: widget?.styleModel?.totalEarningText ?? '累计收益(¥)', | |||
textColor: widget?.styleModel?.totalEarningTextColor ?? '#333333', | |||
textSize: 10, | |||
number: widget?.dataModel?.totalFin ?? '0.00', | |||
numberColor: widget?.styleModel?.teamViewItem?.totalEarningValueColor ?? '#FF4242', | |||
numberColor: widget?.styleModel?.totalEarningValueColor ?? '#FF4242', | |||
numberSize: 20, | |||
), | |||
@@ -325,21 +324,21 @@ class _TeamFansItemState extends State<TeamFansItem> { | |||
children: <Widget>[ | |||
/// 本周收益 | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.weekEarningText ?? '本周收益', | |||
textColor: widget?.styleModel?.teamViewItem?.weekEarningTextColor ?? '#909090', | |||
text: widget?.styleModel?.weekEarningText ?? '本周收益', | |||
textColor: widget?.styleModel?.weekEarningTextColor ?? '#909090', | |||
textSize: 10, | |||
number: widget?.dataModel?.weekFin ?? '0.00', | |||
numberColor: widget?.styleModel?.teamViewItem?.weekEarningValueColor ?? '#333333', | |||
numberColor: widget?.styleModel?.weekEarningValueColor ?? '#333333', | |||
numberSize: 15, | |||
), | |||
/// 本月邀请 | |||
_getCustomWidget( | |||
text: widget?.styleModel?.teamViewItem?.monthEarningText ?? '本月收益', | |||
textColor: widget?.styleModel?.teamViewItem?.monthEarningTextColor ?? '#909090', | |||
text: widget?.styleModel?.monthEarningText ?? '本月收益', | |||
textColor: widget?.styleModel?.monthEarningTextColor ?? '#909090', | |||
textSize: 10, | |||
number: widget?.dataModel?.monthFin ?? '0.00', | |||
numberColor: widget?.styleModel?.teamViewItem?.monthEarningValueColor ?? '#333333', | |||
numberColor: widget?.styleModel?.monthEarningValueColor ?? '#333333', | |||
numberSize: 15, | |||
), | |||
], | |||
@@ -56,14 +56,14 @@ class __TeamFansWidgetContainerState extends State<_TeamFansWidgetContainer> { | |||
/// 上拉更多 | |||
void _onLoading() async { | |||
// if(widget.tabCurrentIndex == tabSelectIndex ) { | |||
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnLoadEevnt()); | |||
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnLoadEevnt()); | |||
// } | |||
} | |||
/// 下拉刷新 | |||
void _onRefresh() async { | |||
// if(widget.tabCurrentIndex == tabSelectIndex || _refreshController.initialRefresh) { | |||
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnRefreshEvent()); | |||
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnRefreshEvent()); | |||
// } | |||
} | |||
@@ -79,7 +79,7 @@ class __TeamFansWidgetContainerState extends State<_TeamFansWidgetContainer> { | |||
if (null != notifier) { | |||
tabSelectIndex = notifier?.getTabIndex() ?? 0; | |||
Map<String, String> reqArgs = notifier?.getReqArgs() ?? null; | |||
if(widget.tabCurrentIndex == tabSelectIndex && !EmptyUtil.isEmpty(reqArgs)) { | |||
if (widget.tabCurrentIndex == tabSelectIndex && !EmptyUtil.isEmpty(reqArgs)) { | |||
Logger.log('didChangeDependencies, currentTabIndex = ${widget?.tabCurrentIndex}, tabSelectIndex = $tabSelectIndex , reqArgs = ${reqArgs?.toString()}'); | |||
// _refreshController.refreshToIdle(); | |||
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansFilterEvent(args: reqArgs)); | |||
@@ -172,7 +172,7 @@ class __TeamFansWidgetContainerState extends State<_TeamFansWidgetContainer> { | |||
return TeamFansNumberItemWidget(widget?.styleModel, state?.model); | |||
} else { | |||
TeamFansListItemModel itemModel = state.model.fans[index - 1]; | |||
return TeamFansItem(widget?.styleModel, itemModel); | |||
return TeamFansItem(widget?.styleModel?.teamViewItem, itemModel); | |||
} | |||
}, | |||
itemCount: lenght + 1, | |||
@@ -1,83 +1,101 @@ | |||
import 'package:zhiying_base_widget/pages/team_details_page/model/team_details_data_model.dart'; | |||
import 'package:zhiying_base_widget/pages/team_details_page/model/team_details_style_model.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:flutter/material.dart'; | |||
class TeamDetailsMonthDataWidget extends StatelessWidget { | |||
TeamDetailsStyleModelDashbordItem styleModel; | |||
TeamDetailsDashBoardItem dataModel; | |||
TeamDetailsMonthDataWidget(this.styleModel, this.dataModel); | |||
@override | |||
Widget build(BuildContext context) { | |||
Logger.log('dataModel = ${dataModel?.toJson()?.toString()}'); | |||
return _getContentWidget(); | |||
} | |||
/// content | |||
Widget _getContentWidget() { | |||
return Container( | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex('#FFFFFF'), | |||
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), | |||
borderRadius: BorderRadius.circular(10), | |||
), | |||
margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5), | |||
padding: const EdgeInsets.only(bottom: 10), | |||
child: Column( | |||
children: <Widget>[ | |||
Transform.translate( | |||
offset: Offset(0, -5), | |||
child: Container(height: 30, width: 82, color: Colors.red), | |||
), | |||
const SizedBox(height: 6), | |||
Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |||
children: <Widget>[ | |||
/// 今日贡献 | |||
_getLeftValueWidget(), | |||
/// 分割线 | |||
Container( | |||
width: 0.5, | |||
height: 18.5, | |||
child: VerticalDivider(width: 0.5, thickness: 0.5, color: HexColor.fromHex('#F2F2F2')) | |||
), | |||
/// 贡献收入 | |||
_getRightValueWidget(), | |||
], | |||
child: Column(children: <Widget>[ | |||
Transform.translate( | |||
offset: Offset(0, -5), | |||
child: Container( | |||
alignment: Alignment.center, | |||
height: 30, | |||
width: 82, | |||
padding: const EdgeInsets.only(bottom: 8), | |||
decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(styleModel?.title_bg_img ?? ''))), | |||
child: Text( | |||
styleModel?.title ?? '', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.title_color ?? '#FFFFFF'), fontSize: 13), | |||
), | |||
] | |||
), | |||
), | |||
), | |||
const SizedBox(height: 6), | |||
Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |||
children: _buildDataWidgets(), | |||
), | |||
]), | |||
); | |||
} | |||
/// 左边 | |||
Widget _getLeftValueWidget() { | |||
return _getCustomWidget(text: '自购订单(个)', | |||
textColor: '#999999', | |||
textSize: 11, | |||
number: '158.58', | |||
numberColor: '#333333', | |||
numberSize: 17, | |||
icon: 'sss'); | |||
/// 分割线 | |||
Widget _buildVerticalDividerWidget() { | |||
return Container(width: 0.5, height: 18.5, child: VerticalDivider(width: 0.5, thickness: 0.5, color: HexColor.fromHex('#F2F2F2'))); | |||
} | |||
/// 右边 | |||
Widget _getRightValueWidget() { | |||
return _getCustomWidget(text: '预估收益(元)', | |||
textColor: '#999999', | |||
textSize: 11, | |||
number: '158.58', | |||
numberColor: '#333333', | |||
numberSize: 17, | |||
icon: 'sss'); | |||
/// 构建数据 | |||
List<Widget> _buildDataWidgets() { | |||
List<Widget> widgets = []; | |||
int length = styleModel?.texts?.length ?? 0; | |||
int dataLength = dataModel?.data_list?.length ?? 0; | |||
if (length > 0) { | |||
for (int i = 0; i < length; i++) { | |||
String element = styleModel.texts[i]; | |||
String value = (dataLength > 0 && dataLength == length) ? dataModel.data_list[i] : '0.0'; | |||
widgets.add(_getValueWidget(element, value)); | |||
widgets.add(_buildVerticalDividerWidget()); | |||
} | |||
// styleModel.texts.forEach((element) { | |||
// widgets.add(_getValueWidget(element, '0.0')); | |||
// widgets.add(_buildVerticalDividerWidget()); | |||
// }); | |||
widgets.removeLast(); //去除最后一个分割线 | |||
} | |||
return widgets; | |||
} | |||
/// 数据 | |||
Widget _getValueWidget(String text, String value) { | |||
return _getCustomWidget( | |||
text: text ?? '', | |||
textColor: styleModel?.text_color ?? '#999999', | |||
textSize: 11, | |||
number: value ?? '0.0', | |||
numberColor: styleModel?.value_color ?? '#333333', | |||
numberSize: 17, | |||
icon: styleModel?.text_icon, | |||
); | |||
} | |||
/// 自定义Widget | |||
Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { | |||
return Column( | |||
children: <Widget>[ | |||
/// number | |||
Text(number, style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold)), | |||
Text( | |||
number, | |||
style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget'), | |||
), | |||
/// text | |||
Row( | |||
@@ -85,7 +103,16 @@ class TeamDetailsMonthDataWidget extends StatelessWidget { | |||
Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)), | |||
/// icon | |||
Visibility(visible: !EmptyUtil.isEmpty(icon), child: Container(width: 11, height: 11, color: Colors.red)) | |||
Visibility( | |||
visible: !EmptyUtil.isEmpty(icon), | |||
child: Container( | |||
margin: const EdgeInsets.only(left: 3), | |||
width: 11, | |||
height: 11, | |||
child: CachedNetworkImage( | |||
imageUrl: icon ?? '', | |||
), | |||
)) | |||
], | |||
) | |||
], | |||
@@ -1,8 +1,21 @@ | |||
import 'package:flutter/material.dart'; | |||
import 'package:zhiying_base_widget/pages/team_details_page/model/team_details_style_model.dart'; | |||
import 'package:zhiying_base_widget/widgets/team/fans_list/model/team_fans_list_model.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'dart:ui' as ui show PlaceholderAlignment; | |||
import 'package:fluttertoast/fluttertoast.dart'; | |||
import 'dart:ui' as ui show PlaceholderAlignment; | |||
class TeamDetailsReferrerWidget extends StatelessWidget { | |||
TeamDetailsStyleModelHeaderReferrer styleModel; | |||
TeamFansListItemModel dataModel; | |||
TeamDetailsReferrerWidget(this.styleModel, this.dataModel); | |||
/// 复制文字 | |||
void _copyText() { | |||
Fluttertoast.showToast(msg: '复制成功~'); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
return Container( | |||
@@ -15,7 +28,6 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
padding: const EdgeInsets.only(left: 9.5, right: 20, bottom: 10), | |||
child: Column( | |||
children: <Widget>[ | |||
/// 推荐人图片 | |||
_getLeftTopWidget(), | |||
@@ -33,15 +45,22 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
} | |||
/// 推荐人左上角Icon | |||
Widget _getLeftTopWidget(){ | |||
Widget _getLeftTopWidget() { | |||
return Align( | |||
alignment: Alignment.topLeft, | |||
child: Transform.translate( | |||
offset: Offset(0, -5), | |||
child: Container( | |||
width: 80, | |||
height: 23.5, | |||
color: Colors.red, | |||
// width: 80, | |||
// height: 23.5, | |||
padding: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4.5), | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(4), | |||
gradient: LinearGradient(begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ | |||
HexColor.fromHex(styleModel?.title_bg_color ?? '#FF5E5E'), | |||
HexColor.fromHex(styleModel?.title_bg_color_t ?? '#FF5252'), | |||
])), | |||
child: Text(styleModel?.title ?? 'TA的推荐人', style: TextStyle(color: HexColor.fromHex(styleModel?.title_color ?? '#FFFFFF'), fontSize: 11)), | |||
), | |||
), | |||
); | |||
@@ -52,7 +71,13 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
return Row( | |||
children: <Widget>[ | |||
/// 头像 | |||
Container(width: 50, height: 50, color: Colors.red), | |||
Container( | |||
width: 50, | |||
height: 50, | |||
child: CachedNetworkImage( | |||
imageUrl: dataModel?.avatar ?? '', | |||
), | |||
), | |||
const SizedBox(width: 10), | |||
/// 信息 | |||
@@ -63,15 +88,41 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
/// 会员等级 关系 昵称 | |||
RichText( | |||
textAlign: TextAlign.center, | |||
text: TextSpan(text: '', children: [ | |||
text: TextSpan(children: [ | |||
/// 等级 | |||
WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 37, height: 13, color: Colors.red)), | |||
WidgetSpan( | |||
alignment: ui.PlaceholderAlignment.middle, | |||
child: Container( | |||
margin: const EdgeInsets.only(right: 4), | |||
padding: const EdgeInsets.only(left: 3, right: 2, top: 2, bottom: 2), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(dataModel?.levelBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
), | |||
alignment: Alignment.center, | |||
child: Row( | |||
children: <Widget>[ | |||
CachedNetworkImage( | |||
imageUrl: dataModel?.levelIcon ?? '', | |||
width: 11, | |||
), | |||
const SizedBox(width: 2.5), | |||
Text( | |||
dataModel?.levelName ?? '黑钻会员', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.lv_text_color ?? 'FFFFFF'), fontSize: 8), | |||
), | |||
], | |||
), | |||
), | |||
), | |||
/// 会员关系 | |||
WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 13, height: 13, color: Colors.red, margin: const EdgeInsets.only(left: 3, right: 3))), | |||
// WidgetSpan(alignment: ui.PlaceholderAlignment.middle, child: Container(width: 13, height: 13, color: Colors.red, margin: const EdgeInsets.only(left: 3, right: 3))), | |||
/// 会员名称 | |||
TextSpan(text: '温***哥', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 12, fontWeight: FontWeight.bold)) | |||
TextSpan( | |||
text: dataModel?.blurUserName ?? '', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.username_color ?? '#333333'), fontSize: 12, fontWeight: FontWeight.bold)) | |||
]), | |||
), | |||
const SizedBox(height: 2.5), | |||
@@ -79,13 +130,16 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
/// 手机号码 | |||
RichText( | |||
textAlign: TextAlign.center, | |||
text: TextSpan(text: '', children: [ | |||
text: TextSpan(children: [ | |||
/// 手机号码 | |||
TextSpan(text: '手机号:', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11)), | |||
TextSpan(text: '124****6124', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
TextSpan(text: styleModel?.phone_text ?? '手机号:', style: TextStyle(color: HexColor.fromHex(styleModel?.phone_color ?? '#333333'), fontSize: 11)), | |||
TextSpan( | |||
text: dataModel?.blurMobile ?? '', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.phone_color ?? '#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
/// 复制按钮 | |||
WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(width: 11, height: 11, color: Colors.red, margin: const EdgeInsets.only(left: 3))) | |||
_getCopyWidget(), | |||
// _getCopyWidget(), | |||
]), | |||
), | |||
], | |||
@@ -94,12 +148,29 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
); | |||
} | |||
/// 复制按钮 | |||
InlineSpan _getCopyWidget() { | |||
return WidgetSpan( | |||
alignment: ui.PlaceholderAlignment.middle, | |||
child: GestureDetector( | |||
behavior: HitTestBehavior.opaque, | |||
onTap: () => _copyText(), | |||
child: Container( | |||
width: 15, | |||
padding: const EdgeInsets.only(left: 3), | |||
child: CachedNetworkImage( | |||
imageUrl: styleModel?.copy_btn_icon ?? '', | |||
), | |||
), | |||
)); | |||
} | |||
/// 微信号码信息 | |||
Widget _getWXNumberInfoWidget() { | |||
return Container( | |||
padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex('#F7F7F7'), | |||
color: HexColor.fromHex(styleModel?.bar_color ?? '#F7F7F7'), | |||
borderRadius: BorderRadius.circular(5), | |||
), | |||
child: Row( | |||
@@ -108,17 +179,33 @@ class TeamDetailsReferrerWidget extends StatelessWidget { | |||
/// 微信号码 | |||
RichText( | |||
textAlign: TextAlign.center, | |||
text: TextSpan(text: '', children: [ | |||
TextSpan(text: '微信号:', style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11, fontWeight: FontWeight.bold)), | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: styleModel?.wx_text ?? '微信号:', style: TextStyle(color: HexColor.fromHex(styleModel?.wx_color ?? '#999999'), fontSize: 11, fontWeight: FontWeight.bold)), | |||
TextSpan( | |||
text: '54A78', | |||
style: TextStyle(fontWeight: FontWeight.bold, color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
WidgetSpan(alignment: ui.PlaceholderAlignment.middle,child: Container(margin: const EdgeInsets.only(left: 5.5), color: Colors.red, width: 11, height: 11)) | |||
text: dataModel?.blurWeChat ?? '', | |||
style: TextStyle( | |||
fontWeight: FontWeight.bold, | |||
color: HexColor.fromHex(styleModel?.wx_value_color ?? '#333333'), | |||
fontSize: 11, | |||
fontFamily: 'Din', | |||
package: 'zhiying_base_widget')), | |||
_getCopyWidget(), | |||
]), | |||
), | |||
/// 最近登陆时间 | |||
Text('最近登陆 2019-06-28', style: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')) | |||
RichText( | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: styleModel?.last_login_text ?? '最近登陆', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.last_login_text_color ?? '#909090'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
TextSpan( | |||
text: dataModel?.lastLogin ?? '', | |||
style: TextStyle(color: HexColor.fromHex(styleModel?.last_login_value_color ?? '#909090'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
]), | |||
), | |||
], | |||
), | |||
); | |||