Browse Source

1、人脉的用户详情实现

tags/0.0.1
PH2 4 years ago
parent
commit
6a1c29e737
11 changed files with 533 additions and 233 deletions
  1. +5
    -2
      lib/pages/team_details_page/bloc/team_details_repository.dart
  2. +124
    -1
      lib/pages/team_details_page/model/team_details_data_model.dart
  3. +54
    -48
      lib/pages/team_details_page/model/team_details_style_model.dart
  4. +116
    -60
      lib/pages/team_details_page/team_details_page.dart
  5. +5
    -5
      lib/pages/team_page/model/team_style_model.dart
  6. +0
    -1
      lib/pages/team_page/team_page.dart
  7. +1
    -1
      lib/widgets/team/fans_list/model/team_fans_list_model.dart
  8. +37
    -38
      lib/widgets/team/fans_list/team_fans_item.dart
  9. +4
    -4
      lib/widgets/team/fans_list/team_fans_widget.dart
  10. +78
    -51
      lib/widgets/team_details/month_data/team_details_month_data_widget.dart
  11. +109
    -22
      lib/widgets/team_details/referrer/team_details_referrer_widget.dart

+ 5
- 2
lib/pages/team_details_page/bloc/team_details_repository.dart View File

@@ -9,13 +9,16 @@ class TeamDetailsRepository {
TeamDetailsDataModel _dataModel; TeamDetailsDataModel _dataModel;


/// 初始化数据 /// 初始化数据
Future<dynamic> fetchNetData(final Map<String, dynamic> data) async {
Future<TeamDetailsDataModel> fetchNetData(final Map<String, dynamic> data) async {
try { try {
if (!EmptyUtil.isEmpty(data)) { if (!EmptyUtil.isEmpty(data)) {
String fansId = data['uid']; String fansId = data['uid'];
if (!EmptyUtil.isEmpty(fansId)) { if (!EmptyUtil.isEmpty(fansId)) {
var result = await NetUtil.post('/api/v1/user/fan/$fansId', method: NetMethod.GET); 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) { } catch (e, s) {


+ 124
- 1
lib/pages/team_details_page/model/team_details_data_model.dart View File

@@ -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;
}
}

+ 54
- 48
lib/pages/team_details_page/model/team_details_style_model.dart View File

@@ -1,7 +1,6 @@
import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart'; import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';



@immutable @immutable
class TeamDetailsStyleModel { class TeamDetailsStyleModel {
String app_bar_bg_color; String app_bar_bg_color;
@@ -12,8 +11,10 @@ class TeamDetailsStyleModel {
List<TeamDetailsStyleModelDashbord> dashbord; List<TeamDetailsStyleModelDashbord> dashbord;
List<TeamDetailsStyleModelDashbordItem> dashbord_items; List<TeamDetailsStyleModelDashbordItem> dashbord_items;
String dashbord_line_color; String dashbord_line_color;
String name_color;
String name_selected_color;
TeamDetailsStyleModelHeaderReferrer header_referrer; TeamDetailsStyleModelHeaderReferrer header_referrer;
TeamViewItem self_info;
TeamViewItemStyle self_info;


TeamDetailsStyleModel({ TeamDetailsStyleModel({
this.app_bar_bg_color, this.app_bar_bg_color,
@@ -26,10 +27,14 @@ class TeamDetailsStyleModel {
this.dashbord_line_color, this.dashbord_line_color,
this.header_referrer, this.header_referrer,
this.self_info, this.self_info,
this.name_color,
this.name_selected_color,
}); });


factory TeamDetailsStyleModel.fromJson(Map<String, dynamic> json) { factory TeamDetailsStyleModel.fromJson(Map<String, dynamic> json) {
return TeamDetailsStyleModel( 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_color: json['app_bar_bg_color'],
app_bar_bg_img: json['app_bar_bg_img'], app_bar_bg_img: json['app_bar_bg_img'],
app_bar_name: json['app_bar_name'], 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_items: json['dashbord_items'] != null ? (json['dashbord_items'] as List).map((i) => TeamDetailsStyleModelDashbordItem.fromJson(i)).toList() : null,
dashbord_line_color: json['dashbord_line_color'], dashbord_line_color: json['dashbord_line_color'],
header_referrer: json['header_referrer'] != null ? TeamDetailsStyleModelHeaderReferrer.fromJson(json['header_referrer']) : null, 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['app_bar_name_color'] = this.app_bar_name_color;
data['bg_color'] = this.bg_color; data['bg_color'] = this.bg_color;
data['dashbord_line_color'] = this.dashbord_line_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) { if (this.dashbord != null) {
data['dashbord'] = this.dashbord.map((v) => v.toJson()).toList(); data['dashbord'] = this.dashbord.map((v) => v.toJson()).toList();
} }
@@ -127,47 +134,51 @@ class TeamDetailsStyleModelHeaderReferrer {
String wx_color; String wx_color;
String wx_text; String wx_text;
String wx_value_color; 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) { factory TeamDetailsStyleModelHeaderReferrer.fromJson(Map<String, dynamic> json) {
return TeamDetailsStyleModelHeaderReferrer( 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_color'] = this.wx_color;
data['wx_text'] = this.wx_text; data['wx_text'] = this.wx_text;
data['wx_value_color'] = this.wx_value_color; data['wx_value_color'] = this.wx_value_color;
data['lv_text_color'] = this.lv_text_color;
return data; return data;
} }
} }


class TeamDetailsStyleModelDashbord { class TeamDetailsStyleModelDashbord {
String name; 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) { factory TeamDetailsStyleModelDashbord.fromJson(Map<String, dynamic> json) {
return TeamDetailsStyleModelDashbord( return TeamDetailsStyleModelDashbord(
name: json['name'], name: json['name'],
name_color: json['name_color'],
name_selected_color: json['name_selected_color'],
); );
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name; data['name'] = this.name;
data['name_color'] = this.name_color;
data['name_selected_color'] = this.name_selected_color;
return data; return data;
} }
} }

+ 116
- 60
lib/pages/team_details_page/team_details_page.dart View File

@@ -34,15 +34,50 @@ class _TeamDetailsPage extends StatefulWidget {
} }


class _TeamDetailsPageState extends State<_TeamDetailsPage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocConsumer<TeamDetailsBloc, TeamDetailsState>( return BlocConsumer<TeamDetailsBloc, TeamDetailsState>(
listener: (context, state) {}, listener: (context, state) {},
buildWhen: (prov, current) { buildWhen: (prov, current) {
if (current is TeamDetailsErrorState) {
return false;
}
return true; return true;
}, },
builder: (context, state) { builder: (context, state) {
if (state is TeamDetailsLoadedState) { if (state is TeamDetailsLoadedState) {
_initTabController(state?.styleModel);
return _getMainWidget(state?.styleModel, state?.dataModel); return _getMainWidget(state?.styleModel, state?.dataModel);
} }
return _getMainWidget(null, null); 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) { Widget _getMainWidget(TeamDetailsStyleModel styleModel, TeamDetailsDataModel dataModel) {
return Scaffold( return Scaffold(
@@ -60,72 +93,65 @@ class _TeamDetailsPageState extends State<_TeamDetailsPage> {
slivers: <Widget>[ slivers: <Widget>[
/// 头部Bar /// 头部Bar
SliverAppBar( 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的推荐人 /// 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( 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)) 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();
}
}
} }

+ 5
- 5
lib/pages/team_page/model/team_style_model.dart View File

@@ -41,7 +41,7 @@ class TeamStyleModel {
String teamViewEmptyImg; String teamViewEmptyImg;
List<TeamViewSortList> teamViewSortList; List<TeamViewSortList> teamViewSortList;
List<TeamViewItemTitleList> teamViewItemTitleList; List<TeamViewItemTitleList> teamViewItemTitleList;
TeamViewItem teamViewItem;
TeamViewItemStyle teamViewItem;


String headerNoReferrerInputColor; String headerNoReferrerInputColor;
String headerNoReferrerInputBgColor; String headerNoReferrerInputBgColor;
@@ -169,7 +169,7 @@ class TeamStyleModel {
teamViewItemTitleList.add(new TeamViewItemTitleList.fromJson(v)); 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']; headerNoReferrerInputColor = json['header_no_referrer_intput_color'];
headerNoReferrerInputBgColor = json['header_no_referrer_intput_bg_color']; headerNoReferrerInputBgColor = json['header_no_referrer_intput_bg_color'];
headerReferrerInvitecodeText = json['header_referrer_invitecode_text']; headerReferrerInvitecodeText = json['header_referrer_invitecode_text'];
@@ -437,7 +437,7 @@ class TeamViewItemTitleList {
} }
} }


class TeamViewItem extends SkipModel{
class TeamViewItemStyle extends SkipModel{
String lvTextColor; String lvTextColor;
String lvBgColor; String lvBgColor;
String lvBgImg; String lvBgImg;
@@ -478,7 +478,7 @@ class TeamViewItem extends SkipModel{
String monthEarningTextColor; String monthEarningTextColor;
String monthEarningValueColor; String monthEarningValueColor;


TeamViewItem(
TeamViewItemStyle(
{this.lvTextColor, {this.lvTextColor,
this.lvBgColor, this.lvBgColor,
this.lvBgImg, this.lvBgImg,
@@ -519,7 +519,7 @@ class TeamViewItem extends SkipModel{
this.monthEarningTextColor, this.monthEarningTextColor,
this.monthEarningValueColor}); this.monthEarningValueColor});


TeamViewItem.fromJson(Map<String, dynamic> json) {
TeamViewItemStyle.fromJson(Map<String, dynamic> json) {
super.fromJson(json); super.fromJson(json);
lvTextColor = json['lv_text_color']; lvTextColor = json['lv_text_color'];
lvBgColor = json['lv_bg_color']; lvBgColor = json['lv_bg_color'];


+ 0
- 1
lib/pages/team_page/team_page.dart View File

@@ -53,7 +53,6 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {
// TabController 监听 // TabController 监听
void _tabChangeListener(){ void _tabChangeListener(){
if (!_controller.indexIsChanging) { if (!_controller.indexIsChanging) {
Logger.log('this TabController is ${_controller?.index}');
Provider.of<TeamPageNotifier>(context, listen: false).updateTabIndex(_controller?.index ?? 0); Provider.of<TeamPageNotifier>(context, listen: false).updateTabIndex(_controller?.index ?? 0);
} }
} }


+ 1
- 1
lib/widgets/team/fans_list/model/team_fans_list_model.dart View File

@@ -52,7 +52,7 @@ class TeamFansListItemModel {


// 获取模糊昵称 // 获取模糊昵称
get blurUserName => 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; get blurWeChat => !EmptyUtil.isEmpty(wechat) ? wechat.length > 6 ? '${wechat.substring(0, 3)}****${wechat.substring(wechat.length - 3, wechat.length)}' : wechat : wechat;


+ 37
- 38
lib/widgets/team/fans_list/team_fans_item.dart View File

@@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
import 'package:cached_network_image/cached_network_image.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'; 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 { class TeamFansItem extends StatefulWidget {
TeamStyleModel styleModel;
TeamViewItemStyle styleModel;
TeamFansListItemModel dataModel; TeamFansListItemModel dataModel;


TeamFansItem(this.styleModel, this.dataModel); TeamFansItem(this.styleModel, this.dataModel);
@@ -25,7 +24,7 @@ class _TeamFansItemState extends State<TeamFansItem> {
/// 跳去粉丝详情 /// 跳去粉丝详情
void _openFansItemDetailsPage() { void _openFansItemDetailsPage() {
// Navigator.push(context, CupertinoPageRoute(builder: (_) => TeamDetailsPage(null))); // 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), const SizedBox(width: 2.5),
Text( Text(
widget?.dataModel?.levelName ?? '黑钻会员', 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, alignment: Alignment.center,
padding: const EdgeInsets.only(left: 2.5, right: 2.5, top: 2, bottom: 2), padding: const EdgeInsets.only(left: 2.5, right: 2.5, top: 2, bottom: 2),
margin: const EdgeInsets.only(left: 3, right: 3), 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( child: Text(
widget?.dataModel?.levelType ?? '直', 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( TextSpan(
text: widget?.dataModel?.blurUserName ?? '***', 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), const SizedBox(height: 2.5),
@@ -135,12 +134,12 @@ class _TeamFansItemState extends State<TeamFansItem> {
text: TextSpan(text: '', children: [ text: TextSpan(text: '', children: [
/// 手机号码 /// 手机号码
TextSpan( 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( TextSpan(
text: widget?.dataModel?.blurMobile ?? '', text: widget?.dataModel?.blurMobile ?? '',
style: TextStyle( 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( WidgetSpan(
@@ -152,7 +151,7 @@ class _TeamFansItemState extends State<TeamFansItem> {
width: 11, width: 11,
margin: const EdgeInsets.only(left: 3), margin: const EdgeInsets.only(left: 3),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: widget?.styleModel?.teamViewItem?.phoneCopyIcon ?? '',
imageUrl: widget?.styleModel?.phoneCopyIcon ?? '',
), ),
), ),
)) ))
@@ -169,7 +168,7 @@ class _TeamFansItemState extends State<TeamFansItem> {
return Container( return Container(
padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5), padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarColor ?? '#F7F7F7'),
color: HexColor.fromHex(widget?.styleModel?.infoBarColor ?? '#F7F7F7'),
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
), ),
child: Row( child: Row(
@@ -180,16 +179,16 @@ class _TeamFansItemState extends State<TeamFansItem> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan(text: '', children: [ text: TextSpan(text: '', children: [
TextSpan( TextSpan(
text: widget?.styleModel?.teamViewItem?.infoBarWxText ?? '微信号:',
text: widget?.styleModel?.infoBarWxText ?? '微信号:',
style: TextStyle( style: TextStyle(
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarWxTextColor ?? '#999999'),
color: HexColor.fromHex(widget?.styleModel?.infoBarWxTextColor ?? '#999999'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 11, fontSize: 11,
)), )),
TextSpan( TextSpan(
text: widget?.dataModel?.blurWeChat ?? '', text: widget?.dataModel?.blurWeChat ?? '',
style: TextStyle( style: TextStyle(
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarWxValueColor ?? '#333333'),
color: HexColor.fromHex(widget?.styleModel?.infoBarWxValueColor ?? '#333333'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 11, fontSize: 11,
fontFamily: 'Din', fontFamily: 'Din',
@@ -205,7 +204,7 @@ class _TeamFansItemState extends State<TeamFansItem> {
padding: const EdgeInsets.only(left: 5.5), padding: const EdgeInsets.only(left: 5.5),
width: 11 + 5.5, width: 11 + 5.5,
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: widget?.styleModel?.teamViewItem?.phoneCopyIcon ?? '',
imageUrl: widget?.styleModel?.phoneCopyIcon ?? '',
)), )),
)) ))
]), ]),
@@ -216,15 +215,15 @@ class _TeamFansItemState extends State<TeamFansItem> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan(children: [ text: TextSpan(children: [
TextSpan( TextSpan(
text: widget?.styleModel?.teamViewItem?.infoBarLastLoginText ?? '最近登陆 ',
text: widget?.styleModel?.infoBarLastLoginText ?? '最近登陆 ',
style: TextStyle( style: TextStyle(
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarLastLoginTextColor ?? '#909090'),
color: HexColor.fromHex(widget?.styleModel?.infoBarLastLoginTextColor ?? '#909090'),
fontSize: 11, fontSize: 11,
)), )),
TextSpan( TextSpan(
text: widget?.dataModel?.lastLogin ?? '', text: widget?.dataModel?.lastLogin ?? '',
style: TextStyle( style: TextStyle(
color: HexColor.fromHex(widget?.styleModel?.teamViewItem?.infoBarLastLoginValueColor ?? '#909090'),
color: HexColor.fromHex(widget?.styleModel?.infoBarLastLoginValueColor ?? '#909090'),
fontSize: 11, fontSize: 11,
fontFamily: 'Din', fontFamily: 'Din',
package: 'zhiying_base_widget')), package: 'zhiying_base_widget')),
@@ -252,11 +251,11 @@ class _TeamFansItemState extends State<TeamFansItem> {
children: <Widget>[ children: <Widget>[
/// 邀请人数(人) /// 邀请人数(人)
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.totalInviteText ?? '邀请人数(人)',
textColor: widget?.styleModel?.teamViewItem?.totalInviteTextColor ?? '#333333',
text: widget?.styleModel?.totalInviteText ?? '邀请人数(人)',
textColor: widget?.styleModel?.totalInviteTextColor ?? '#333333',
textSize: 10, textSize: 10,
number: widget?.dataModel?.inviteCount ?? '0', number: widget?.dataModel?.inviteCount ?? '0',
numberColor: widget?.styleModel?.teamViewItem?.totalInviteValueColor ?? '#FF4242',
numberColor: widget?.styleModel?.totalInviteValueColor ?? '#FF4242',
numberSize: 20, numberSize: 20,
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
@@ -267,21 +266,21 @@ class _TeamFansItemState extends State<TeamFansItem> {
children: <Widget>[ children: <Widget>[
/// 今日邀请 /// 今日邀请
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.todayInviteText ?? '今日邀请',
textColor: widget?.styleModel?.teamViewItem?.todayInviteTextColor ?? '#909090',
text: widget?.styleModel?.todayInviteText ?? '今日邀请',
textColor: widget?.styleModel?.todayInviteTextColor ?? '#909090',
textSize: 10, textSize: 10,
number: widget?.dataModel?.todayInviteCount ?? '0', number: widget?.dataModel?.todayInviteCount ?? '0',
numberColor: widget?.styleModel?.teamViewItem?.todayInviteValueColor ?? '#333333',
numberColor: widget?.styleModel?.todayInviteValueColor ?? '#333333',
numberSize: 15, numberSize: 15,
), ),


/// 本月邀请 /// 本月邀请
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.monthInviteText ?? '本月邀请',
textColor: widget?.styleModel?.teamViewItem?.monthInviteTextColor ?? '#909090',
text: widget?.styleModel?.monthInviteText ?? '本月邀请',
textColor: widget?.styleModel?.monthInviteTextColor ?? '#909090',
textSize: 10, textSize: 10,
number: widget?.dataModel?.monthInviteCount ?? '0', number: widget?.dataModel?.monthInviteCount ?? '0',
numberColor: widget?.styleModel?.teamViewItem?.monthInviteValueColor ?? '#333333',
numberColor: widget?.styleModel?.monthInviteValueColor ?? '#333333',
numberSize: 15, numberSize: 15,
), ),
], ],
@@ -297,7 +296,7 @@ class _TeamFansItemState extends State<TeamFansItem> {
child: VerticalDivider( child: VerticalDivider(
width: 0.5, width: 0.5,
thickness: 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>[ children: <Widget>[
/// 累计收益(¥) /// 累计收益(¥)
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.totalEarningText ?? '累计收益(¥)',
textColor: widget?.styleModel?.teamViewItem?.totalEarningTextColor ?? '#333333',
text: widget?.styleModel?.totalEarningText ?? '累计收益(¥)',
textColor: widget?.styleModel?.totalEarningTextColor ?? '#333333',
textSize: 10, textSize: 10,
number: widget?.dataModel?.totalFin ?? '0.00', number: widget?.dataModel?.totalFin ?? '0.00',
numberColor: widget?.styleModel?.teamViewItem?.totalEarningValueColor ?? '#FF4242',
numberColor: widget?.styleModel?.totalEarningValueColor ?? '#FF4242',
numberSize: 20, numberSize: 20,
), ),


@@ -325,21 +324,21 @@ class _TeamFansItemState extends State<TeamFansItem> {
children: <Widget>[ children: <Widget>[
/// 本周收益 /// 本周收益
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.weekEarningText ?? '本周收益',
textColor: widget?.styleModel?.teamViewItem?.weekEarningTextColor ?? '#909090',
text: widget?.styleModel?.weekEarningText ?? '本周收益',
textColor: widget?.styleModel?.weekEarningTextColor ?? '#909090',
textSize: 10, textSize: 10,
number: widget?.dataModel?.weekFin ?? '0.00', number: widget?.dataModel?.weekFin ?? '0.00',
numberColor: widget?.styleModel?.teamViewItem?.weekEarningValueColor ?? '#333333',
numberColor: widget?.styleModel?.weekEarningValueColor ?? '#333333',
numberSize: 15, numberSize: 15,
), ),


/// 本月邀请 /// 本月邀请
_getCustomWidget( _getCustomWidget(
text: widget?.styleModel?.teamViewItem?.monthEarningText ?? '本月收益',
textColor: widget?.styleModel?.teamViewItem?.monthEarningTextColor ?? '#909090',
text: widget?.styleModel?.monthEarningText ?? '本月收益',
textColor: widget?.styleModel?.monthEarningTextColor ?? '#909090',
textSize: 10, textSize: 10,
number: widget?.dataModel?.monthFin ?? '0.00', number: widget?.dataModel?.monthFin ?? '0.00',
numberColor: widget?.styleModel?.teamViewItem?.monthEarningValueColor ?? '#333333',
numberColor: widget?.styleModel?.monthEarningValueColor ?? '#333333',
numberSize: 15, numberSize: 15,
), ),
], ],


+ 4
- 4
lib/widgets/team/fans_list/team_fans_widget.dart View File

@@ -56,14 +56,14 @@ class __TeamFansWidgetContainerState extends State<_TeamFansWidgetContainer> {
/// 上拉更多 /// 上拉更多
void _onLoading() async { void _onLoading() async {
// if(widget.tabCurrentIndex == tabSelectIndex ) { // if(widget.tabCurrentIndex == tabSelectIndex ) {
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnLoadEevnt());
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansOnLoadEevnt());
// } // }
} }


/// 下拉刷新 /// 下拉刷新
void _onRefresh() async { void _onRefresh() async {
// if(widget.tabCurrentIndex == tabSelectIndex || _refreshController.initialRefresh) { // 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) { if (null != notifier) {
tabSelectIndex = notifier?.getTabIndex() ?? 0; tabSelectIndex = notifier?.getTabIndex() ?? 0;
Map<String, String> reqArgs = notifier?.getReqArgs() ?? null; 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()}'); Logger.log('didChangeDependencies, currentTabIndex = ${widget?.tabCurrentIndex}, tabSelectIndex = $tabSelectIndex , reqArgs = ${reqArgs?.toString()}');
// _refreshController.refreshToIdle(); // _refreshController.refreshToIdle();
BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansFilterEvent(args: reqArgs)); BlocProvider.of<TeamListFansBloc>(context).add(TeamListFansFilterEvent(args: reqArgs));
@@ -172,7 +172,7 @@ class __TeamFansWidgetContainerState extends State<_TeamFansWidgetContainer> {
return TeamFansNumberItemWidget(widget?.styleModel, state?.model); return TeamFansNumberItemWidget(widget?.styleModel, state?.model);
} else { } else {
TeamFansListItemModel itemModel = state.model.fans[index - 1]; TeamFansListItemModel itemModel = state.model.fans[index - 1];
return TeamFansItem(widget?.styleModel, itemModel);
return TeamFansItem(widget?.styleModel?.teamViewItem, itemModel);
} }
}, },
itemCount: lenght + 1, itemCount: lenght + 1,


+ 78
- 51
lib/widgets/team_details/month_data/team_details_month_data_widget.dart View File

@@ -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:zhiying_comm/zhiying_comm.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';


class TeamDetailsMonthDataWidget extends StatelessWidget { class TeamDetailsMonthDataWidget extends StatelessWidget {
TeamDetailsStyleModelDashbordItem styleModel;
TeamDetailsDashBoardItem dataModel;

TeamDetailsMonthDataWidget(this.styleModel, this.dataModel);

@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Logger.log('dataModel = ${dataModel?.toJson()?.toString()}');
return _getContentWidget(); return _getContentWidget();
} }



/// content /// content
Widget _getContentWidget() { Widget _getContentWidget() {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex('#FFFFFF'),
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5), margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5),
padding: const EdgeInsets.only(bottom: 10), 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
Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) {
return Column( return Column(
children: <Widget>[ children: <Widget>[

/// number /// 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 /// text
Row( Row(
@@ -85,7 +103,16 @@ class TeamDetailsMonthDataWidget extends StatelessWidget {
Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)), Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)),


/// icon /// 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 ?? '',
),
))
], ],
) )
], ],


+ 109
- 22
lib/widgets/team_details/referrer/team_details_referrer_widget.dart View File

@@ -1,8 +1,21 @@
import 'package:flutter/material.dart'; 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 '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 { class TeamDetailsReferrerWidget extends StatelessWidget {
TeamDetailsStyleModelHeaderReferrer styleModel;
TeamFansListItemModel dataModel;

TeamDetailsReferrerWidget(this.styleModel, this.dataModel);

/// 复制文字
void _copyText() {
Fluttertoast.showToast(msg: '复制成功~');
}

@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@@ -15,7 +28,6 @@ class TeamDetailsReferrerWidget extends StatelessWidget {
padding: const EdgeInsets.only(left: 9.5, right: 20, bottom: 10), padding: const EdgeInsets.only(left: 9.5, right: 20, bottom: 10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

/// 推荐人图片 /// 推荐人图片
_getLeftTopWidget(), _getLeftTopWidget(),


@@ -33,15 +45,22 @@ class TeamDetailsReferrerWidget extends StatelessWidget {
} }


/// 推荐人左上角Icon /// 推荐人左上角Icon
Widget _getLeftTopWidget(){
Widget _getLeftTopWidget() {
return Align( return Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -5), offset: Offset(0, -5),
child: Container( 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( return Row(
children: <Widget>[ children: <Widget>[
/// 头像 /// 头像
Container(width: 50, height: 50, color: Colors.red),
Container(
width: 50,
height: 50,
child: CachedNetworkImage(
imageUrl: dataModel?.avatar ?? '',
),
),
const SizedBox(width: 10), const SizedBox(width: 10),


/// 信息 /// 信息
@@ -63,15 +88,41 @@ class TeamDetailsReferrerWidget extends StatelessWidget {
/// 会员等级 关系 昵称 /// 会员等级 关系 昵称
RichText( RichText(
textAlign: TextAlign.center, 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), const SizedBox(height: 2.5),
@@ -79,13 +130,16 @@ class TeamDetailsReferrerWidget extends StatelessWidget {
/// 手机号码 /// 手机号码
RichText( RichText(
textAlign: TextAlign.center, 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() { Widget _getWXNumberInfoWidget() {
return Container( return Container(
padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5), padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex('#F7F7F7'),
color: HexColor.fromHex(styleModel?.bar_color ?? '#F7F7F7'),
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
), ),
child: Row( child: Row(
@@ -108,17 +179,33 @@ class TeamDetailsReferrerWidget extends StatelessWidget {
/// 微信号码 /// 微信号码
RichText( RichText(
textAlign: TextAlign.center, 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( 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')),
]),
),
], ],
), ),
); );


Loading…
Cancel
Save