import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/pages/message_notice_page/bloc/message_notice_bloc.dart';
import 'package:zhiying_base_widget/pages/message_notice_page/bloc/message_notice_repository.dart';
import 'package:zhiying_base_widget/pages/message_notice_page/model/message_notice_data_model.dart';
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

import 'message_notice_page_sk.dart';
import 'model/message_notice_style_model.dart';

///
/// 消息通知页
///
class MessageNoticePage extends StatelessWidget {
  final Map<String, dynamic> data;

  MessageNoticePage(this.data);

  @override
  Widget build(BuildContext context) {
    return BlocProvider<MessageNoticeBloc>(
      create: (_) => MessageNoticeBloc(MessageNoticeRepository(data)),
      child: _MessageNoticePageContainer(
        key: UniqueKey(),
      ),
    );
  }
}

class _MessageNoticePageContainer extends StatefulWidget {
  _MessageNoticePageContainer({Key key}) : super(key: key);

  @override
  __MessageNoticePageContainerState createState() => __MessageNoticePageContainerState();
}

class __MessageNoticePageContainerState extends State<_MessageNoticePageContainer> {
  RefreshController _refreshController;

  /// 刷新
  void _onRefresh() async {
    BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeOnRefreshEvent());
  }

  /// 下拉更多
  void _onLoad() async {
    BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeOnLoadEvent());
  }

  /// 子item点击事件
  void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) {
    /// 消除消息红点
    BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id.toString()));

    /// 如果是消息中心，则重新打开页面加载
    Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'NoticePageType': styleModel?.type, 'NoticePageTitle': styleModel?.name})));
  }

  /// 子item点击的公共跳转
  void _onItemClick(SkipModel model) {
    RouterUtil.route(model, model.toJson(), context);
  }

  @override
  void initState() {
    _refreshController = RefreshController();

    /// 初始化
    BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeInitEvent());
    super.initState();
  }

  @override
  void dispose() {
    _refreshController?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return BlocConsumer<MessageNoticeBloc, MessageNoticeState>(
      listener: (context, state) {},
      buildWhen: (prev, current) {
        /// 上拉更多成功
        if (current is MessageNoticeOnLoadSuccessState) {
          _refreshController.loadComplete();
          return false;
        }

        /// 下拉刷新成功
        if (current is MessageNoticeOnRefreshSuccessState) {
          _refreshController.refreshCompleted(resetFooterState: true);
          return false;
        }

        /// 上拉更多失败
        if (current is MessageNoticeOnLoadErrorState) {
          _refreshController.loadNoData();
          return false;
        }

        /// 下拉刷新失败
        if (current is MessageNoticeOnRefreshErrorState) {
          _refreshController.refreshFailed();
          return false;
        }

        /// 数据加载失败
        if (current is MessageNoticeErrorState) {
          return false;
        }
        return true;
      },
      builder: (context, state) {
        /// 数据加载成功
        if (state is MessageNoticeLoadedState) {
          return _buildDataListWidget(state?.styleModel, state?.dataModel);
        }

        /// 数据初始化失败
        if (state is MessageNoticeInitErrorState) {
          return _buildEmptyWidget();
        }

        /// 骨架图
        return _buildSkeletonWidget();
      },
    );
  }

  /// 有数据
  Widget _buildDataListWidget(MessageNoticeStyleModel styleModel, MessageNoticeDataModel dataModel) {
    return Scaffold(
      appBar: _buildAppBarWidget(styleModel),
      body: SmartRefresher(
        controller: _refreshController,
        onRefresh: _onRefresh,
        onLoading: _onLoad,
        enablePullDown: true,
        enablePullUp: styleModel.isFist ? false : true,
        child: ListView.builder(
            padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8),
            itemCount: dataModel?.list?.length ?? 0,
            itemBuilder: (context, index) {
              /// 子视图的样式类型
              String styleType = styleModel?.styleType ?? 'main';
              MessageNoticeDataItemModel itemDataModel = !EmptyUtil.isEmpty(dataModel.list) ? dataModel.list[index] : null;

              /// 官方活动
              if (styleType == 'official_activity') {
                return _buildOfficialActivitiesStyleWidget(styleModel?.official_activity, itemDataModel);
              }

              ///官方通知
              if (styleType == 'official_notification') {
                return _buildOfficialNoticeStyleWidget(styleModel?.official_notification, itemDataModel);
              }

              /// 交易通知
              if (styleType == 'transaction_notification') {
                return _buildOfficialNoticeStyleWidget2(styleModel?.transaction_notification, itemDataModel);
              }

              /// 推广通知
              if (styleType == 'promotion_notification') {
                return _buildPromoteNoticeStyleWidget(styleModel?.promotion_notification, itemDataModel);
              }

              /// 反馈通知
              if (styleType == 'feedback_notification') {
                return _buildFeedbackNoticeStyleWidget(styleModel?.feedback_notification, itemDataModel);
              }

              /// 默认返回消息中心样式
              return _buildMessageCenterStyleWidget(
                styleModel?.main_notification?.list[index],
                dataModel.list[index],
                index,
                styleModel?.main_notification?.list?.length,
                styleModel?.main_notification?.unread_text_color,
                styleModel?.main_notification?.unread_bg_color,
              );
            }),
      ),
    );
  }

  /// 没有数据
  Widget _buildEmptyWidget() {
    return Scaffold(
      appBar: _buildAppBarWidget(null),
      body: SmartRefresher(
        controller: _refreshController,
        onRefresh: _onRefresh,
        enablePullDown: true,
        enablePullUp: false,
        child: ListView(
          padding: const EdgeInsets.only(top: 30),
          children: <Widget>[
            EmptyWidget(),
          ],
        ),
      ),
    );
  }

  /// 骨架图
  Widget _buildSkeletonWidget() {
    return Scaffold(
      appBar: _buildAppBarWidget(null),
      body: MessageNoticePageSkeleton(),
    );
  }

  /// 消息中心样式
  Widget _buildMessageCenterStyleWidget(
      MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel, int index, int length, String unreadTextColor, String unreadBgColor) {
    var borderRadius = index == 0
        ? BorderRadius.only(topLeft: Radius.circular(7.5), topRight: Radius.circular(7.5))
        : index == length - 1 ? BorderRadius.only(bottomRight: Radius.circular(7.5), bottomLeft: Radius.circular(7.5)) : BorderRadius.only();

    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () => _onMainItemClick(styleModel, dataModel),
      child: Container(
        decoration: BoxDecoration(color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), borderRadius: borderRadius),
        padding: const EdgeInsets.only(left: 15, right: 15, top: 16),
        child: Column(
          children: <Widget>[
            Container(
              // height: 30,
              width: double.infinity,
              child: Row(
                children: <Widget>[
                  _buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unreadCount),
                  const SizedBox(width: 10),
                  Expanded(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        /// 官方活动
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Text(
                              styleModel?.name ?? '官方活动',
                              style: TextStyle(color: HexColor.fromHex(styleModel?.name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 13),
                            ),
                            Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)),
                          ],
                        ),
                        Padding(
                          padding: const EdgeInsets.only(right: 22),
                          child: Text(
                            //'2020年6月23日4:00至6月30日4:00关闭提现aaa',
                            dataModel?.messageContent.title ?? '',
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12),
                          ),
                        ),
                      ],
                    ),
                  )
                ],
              ),
            ),
            Padding(padding: const EdgeInsets.only(top: 14.5), child: Divider(height: 0.5, color: HexColor.fromHex('#EFEFEF')))
          ],
        ),
      ),
    );
  }

  /// 官方通知样式
  Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(
          color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
          borderRadius: BorderRadius.circular(7.5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                _buildCustomerAvatarWidget(icon: styleModel?.icon),
                const SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      /// 标题
                      Text(
                        dataModel?.messageContent.title ?? '',
                        style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
                      ),
                      const SizedBox(height: 5),

                      /// 内容
                      Text(
                        dataModel?.messageContent.title ?? '',
                        maxLines: 3,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
                      )
                    ],
                  ),
                )
              ],
            ),

            /// 时间
            Padding(
                padding: const EdgeInsets.only(top: 16),
                child: Text(
                  dataModel?.dateTime ?? '',
                  style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11),
                ))
          ],
        ),
      ),
    );
  }

  /// 交易通知样式
  Widget _buildOfficialNoticeStyleWidget2(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(
          color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
          borderRadius: BorderRadius.circular(7.5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                _buildCustomerAvatarWidget(icon: styleModel?.icon),
                const SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      /// 标题
                      Text(
                        dataModel?.messageContent.title ?? '',
                        style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
                      ),
                      const SizedBox(height: 5),

                      /// 内容
                      Text(
                        dataModel?.messageContent.title ?? '',
                        maxLines: 3,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
                      )
                    ],
                  ),
                )
              ],
            ),

            /// 时间
            Padding(
                padding: const EdgeInsets.only(top: 16),
                child: Text(
                  dataModel?.dateTime ?? '',
                  style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11),
                ))
          ],
        ),
      ),
    );
  }

  /// 官方活动样式
  Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF')),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            /// 标题
            Text(
              dataModel?.messageContent.title ?? '',
              style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14),
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
            ),
            const SizedBox(height: 6),

            /// 图片海报
            ClipRRect(
                borderRadius: BorderRadius.circular(7.5),
                child: CachedNetworkImage(
                  imageUrl: dataModel?.messageContent?.image ?? '',
                  width: double.infinity,
                )),
            const SizedBox(height: 6.5),

            /// 活动内容
            Text(
              dataModel?.messageContent?.content ?? '',
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')),
            ),

            /// 时间
            const SizedBox(height: 7),
            Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))
          ],
        ),
      ),
    );
  }

  /// 交易通知样式
  Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(
          color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
          borderRadius: BorderRadius.circular(7.5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                _buildCustomerAvatarWidget(icon: styleModel?.icon),
                const SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      /// 标题
                      Text(dataModel?.messageContent.title ?? '',
                          style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
                      const SizedBox(height: 5),

                      /// 内容
                     // _buildCustomerTradeContentWidget(styleModel, dataModel?.transactions),
                    ],
                  ),
                )
              ],
            ),

            /// 时间
            Padding(
                padding: const EdgeInsets.only(top: 16),
                child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)))
          ],
        ),
      ),
    );
  }

  /// 推广通知样式
  Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(
          color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
          borderRadius: BorderRadius.circular(7.5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                _buildCustomerAvatarWidget(icon: styleModel?.icon),
                const SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      /// 标题
                      Text(
                        dataModel?.messageContent.title ?? '',
                        style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
                      ),
                      const SizedBox(height: 5),

                      /// 内容
                      Text(
                        dataModel?.messageContent?.content ?? '恭喜您成功邀请152****5887加入您的团队，快带领小伙伴走向致富之路吧！',
                        maxLines: 3,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
                      )
                    ],
                  ),
                )
              ],
            ),

            /// 时间
            Padding(
                padding: const EdgeInsets.only(top: 16),
                child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)))
          ],
        ),
      ),
    );
  }

  /// 反馈通知样式
  Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) {
    return GestureDetector(
      onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))),
      behavior: HitTestBehavior.opaque,
      child: Container(
        padding: const EdgeInsets.only(left: 15, right: 15, top: 14, bottom: 10),
        margin: const EdgeInsets.only(bottom: 7.5),
        decoration: BoxDecoration(
          color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
          borderRadius: BorderRadius.circular(7.5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                _buildCustomerAvatarWidget(icon: styleModel?.icon),
                const SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      /// 标题
                      Text(dataModel?.messageContent.title ?? '',
                          style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
                      const SizedBox(height: 3),

                      /// 内容
                      Text(   dataModel?.messageContent?.content ?? '',
                          maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11))
                    ],
                  ),
                )
              ],
            ),

            /// 时间
            Padding(
                padding: const EdgeInsets.only(top: 16),
                child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)))
          ],
        ),
      ),
    );
  }

  /// APPBar
  Widget _buildAppBarWidget(MessageNoticeStyleModel styleModel) {
    return AppBar(
      brightness: Brightness.light,
      leading: IconButton(
        icon: Icon(
          Icons.arrow_back_ios,
          size: 22,
          color: HexColor.fromHex('#333333'),
        ),
        onPressed: () => Navigator.maybePop(context),
      ),
      title: Text(
        styleModel?.isFist ?? true ? styleModel?.app_bar_name ?? '消息中心' : styleModel?.styleTitle ?? '',
        style: TextStyle(color: HexColor.fromHex(styleModel?.app_bar_name_color ?? '#333333'), fontSize: 15, fontWeight: FontWeight.bold),
      ),
      centerTitle: true,
      backgroundColor: HexColor.fromHex(styleModel?.app_bar_bg_color ?? '#FFFFFF'),
      elevation: 0,
    );
  }

  /// ================================= 自定义View ================================= ///
  Widget _buildCustomerAvatarWidget({@required String icon, String value, String unreadTextColor, String unreadBgColor}) {
    return Container(
      // width: 30,
      // height: 30,
      child: Stack(
        alignment: AlignmentDirectional.topEnd,
        // mainAxisAlignment: MainAxisAlignment.start,
        // crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            height: 30,
            width: 30,
            child: CachedNetworkImage(
              imageUrl: icon ?? '',
            ),
          ),
          Visibility(
            visible: !EmptyUtil.isEmpty(value) && value != '0',
            child: Transform.translate(
              offset: Offset(5, -4.5),
              child: Container(
                // width: 17,
                // height: 12,
                padding: const EdgeInsets.only(left: 3, right: 3, top: 1, bottom: 1),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    color: HexColor.fromHex(unreadBgColor ?? '#FF4242'),
                    borderRadius: BorderRadius.circular(6),
                    border: Border.all(color: HexColor.fromHex('#FFFFFF'), width: 0.5)),
                child: Text(
                  value ?? '',
                  textAlign: TextAlign.center,
                  style: TextStyle(fontSize: 9, color: HexColor.fromHex(unreadTextColor ?? '#FFFFFF')),
                ),
              ),
            ),
          )
        ],
      ),
    );
  }

  // /// 转账自定义widget
  // Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) {
  //   List<Widget> lists = [];
  //   transactions.forEach((element) {
  //     bool isearnings = (element?.type ?? '') == 'earnings';
  //     lists.add(Padding(
  //       padding: const EdgeInsets.only(bottom: 5),
  //       child: RichText(
  //         textAlign: TextAlign.start,
  //         text: TextSpan(children: [
  //           TextSpan(text: element?.text ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'))),
  //           TextSpan(
  //               text: element?.data ?? '',
  //               style: TextStyle(fontSize: 11, color: HexColor.fromHex(isearnings ? styleModel?.earnings ?? '#FF0100' : styleModel?.message_value_color ?? '#999999'))),
  //         ]),
  //       ),
  //     ));
  //   });
  //
  //   return Column(
  //     crossAxisAlignment: CrossAxisAlignment.start,
  //     children: lists,
  //   );
  // }
}
