|
- import 'package:flutter/material.dart';
- import 'package:zhiying_base_widget/pages/team_page/model/team_data_model.dart';
- import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
- import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
- import 'dart:ui' as ui show PlaceholderAlignment;
- import 'package:cached_network_image/cached_network_image.dart';
-
- ///
- /// 我的团队 - 数据widget
- ///
- class TeamDataWidget extends StatelessWidget {
- TeamStyleModel styleModel;
- TeamDataModel dataModel;
-
- TeamDataWidget(this.styleModel, this.dataModel);
-
- @override
- Widget build(BuildContext context) {
- return Material(
- child: _getMainWidget(),
- );
- }
-
- /// 主视图
- Widget _getMainWidget() {
- return Container(
- width: double.infinity,
- margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8),
- padding: const EdgeInsets.only(left: 10.5, right: 9.5, top: 8, bottom: 8),
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor.fromHex('#FFFFFF')),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- /// 直推人数 & 间推人数
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- /// 直推人数
- _getCustomWidget(
- text: styleModel?.dashbordRowFirst[0]?.name ?? '直推人数',
- textColor: styleModel?.dashbordRowFirst[0]?.nameColor ?? '#999999',
- textSize: 12,
- number: dataModel?.direct_fans_count ?? '0',
- numberColor: styleModel?.dashbordRowFirst[0]?.valueColor ?? '#333333',
- numberSize: 30,
- icon: styleModel?.dashbordRowFirst[0]?.upIcon ?? '',
- ),
-
- /// 分割线
- // VerticalDivider(width: 0.5, thickness: 40, color: HexColor.fromHex('#F0F0F0')),
- SizedBox(
- height: 40,
- child: VerticalDivider(
- thickness: 0.5,
- color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
- width: 0.5,
- )),
-
- /// 间推人数
- _getCustomWidget(
- text: styleModel?.dashbordRowFirst[1]?.name ?? '间推人数',
- textColor: styleModel?.dashbordRowFirst[1]?.nameColor ?? '#999999',
- textSize: 12,
- number: dataModel?.indirect_fans_count ?? '0',
- numberColor: styleModel?.dashbordRowFirst[1]?.valueColor ?? '#333333',
- numberSize: 30,
- icon: styleModel?.dashbordRowFirst[1].upIcon,
- ),
- ],
- ),
-
- /// 分割线
- Divider(thickness: 0.5, height: 20, color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0')),
-
- /// 全部粉丝 & 今日新增 & 昨日新增
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: <Widget>[
- /// 全部粉丝
- _getCustomWidget(
- text: styleModel?.dashbordRowSecond[0]?.name ?? '全部粉丝',
- textColor: styleModel?.dashbordRowSecond[0].name_color ?? '#999999',
- textSize: 11,
- number: dataModel?.all_fans ?? '0',
- numberColor: styleModel?.dashbordRowSecond[0]?.value_color ?? '#333333',
- numberSize: 15,
- ),
-
- /// 分割线
- // VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')),
- SizedBox(
- height: 35,
- child: VerticalDivider(
- thickness: 0.5,
- color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
- width: 0.5,
- )),
-
- /// 今日新增
- _getCustomWidget(
- text: styleModel?.dashbordRowSecond[1]?.name ?? '今日新增',
- textColor: styleModel?.dashbordRowSecond[1].name_color ?? '#999999',
- textSize: 11,
- number: dataModel?.today_add ?? '0',
- numberColor: styleModel?.dashbordRowSecond[1]?.value_color ?? '#333333',
- numberSize: 15,
- ),
-
- /// 分割线
- // VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')),
- SizedBox(
- height: 35,
- child: VerticalDivider(
- thickness: 0.5,
- color: HexColor.fromHex(styleModel?.dashbordLineColor ?? '#F0F0F0'),
- width: 0.5,
- )),
-
- /// 昨日新增
- _getCustomWidget(
- text: styleModel?.dashbordRowSecond[2]?.name ?? '昨日新增',
- textColor: styleModel?.dashbordRowSecond[2].name_color ?? '#999999',
- textSize: 11,
- number: dataModel?.yesterday_add ?? '0',
- numberColor: styleModel?.dashbordRowSecond[2]?.value_color ?? '#333333',
- numberSize: 15,
- ),
- ],
- )
- ],
- ),
- );
- }
-
- /// 自定义Widget
- Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) {
- return Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- /// Number
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- /// nummber\
- Text(number,
- style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_comm')),
-
- /// icon
- Visibility(
- visible: !EmptyUtil.isEmpty(icon),
- child: Align(alignment: Alignment.topLeft, child: Container(width: 5, child: CachedNetworkImage(imageUrl: icon ?? ''), margin: const EdgeInsets.only(left: 3))))
- ],
- ),
-
- // RichText(
- // textAlign: TextAlign.center,
- // text: TextSpan(
- // children: [
- // TextSpan(
- // text: number,
- // style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_comm'),
- // ),
- // WidgetSpan(
- // alignment: ui.PlaceholderAlignment.top,
- // child: Visibility(
- // visible: !EmptyUtil.isEmpty(icon), child: Align(alignment: Alignment.topLeft, child: Container(height: 7, width: 5, color: Colors.red, margin: const EdgeInsets.only(left: 3)))
- // )
- // )
- // ]
- // ),
- // ),
-
- /// Text
- Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize))
- ],
- );
- }
- }
|