Переглянути джерело

1、消息的样式实现

2、搜索筛选的ios不能点击 bug修复
3、搜索商品列表的没数据情况视图优化
tags/0.0.1
PH2 4 роки тому
джерело
коміт
5e1fac31a1
8 змінених файлів з 628 додано та 110 видалено
  1. +15
    -1
      lib/pages/message_notice_page/bloc/message_notice_bloc.dart
  2. +39
    -6
      lib/pages/message_notice_page/bloc/message_notice_repository.dart
  3. +15
    -1
      lib/pages/message_notice_page/bloc/message_notice_state.dart
  4. +211
    -79
      lib/pages/message_notice_page/message_notice_page.dart
  5. +311
    -0
      lib/pages/message_notice_page/model/message_notice_style_model.dart
  6. +3
    -3
      lib/pages/search_result_page/item/search_result_item_page.dart
  7. +13
    -2
      lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart
  8. +21
    -18
      lib/widgets/search_result/tarbar/search_result_tab_widget.dart

+ 15
- 1
lib/pages/message_notice_page/bloc/message_notice_bloc.dart Переглянути файл

@@ -3,6 +3,9 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.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_style_model.dart';
import 'package:zhiying_comm/util/empty_util.dart';
import 'package:zhiying_comm/util/log/let_log.dart';

part 'message_notice_event.dart';

@@ -39,7 +42,18 @@ class MessageNoticeBloc extends Bloc<MessageNoticeEvent, MessageNoticeState> {
}

/// 初始化
Stream<MessageNoticeState> _mapInitEventToState(MessageNoticeInitEvent event) async* {}
Stream<MessageNoticeState> _mapInitEventToState(MessageNoticeInitEvent event) async* {
var cacheStyle = await repository.fetchCachedStyle();
if(!EmptyUtil.isEmpty(cacheStyle)){
yield MessageNoticeLoadedState(cacheStyle);
}
var netStyle = await repository.fetchNetStyle();
if(!EmptyUtil.isEmpty(netStyle)){
yield MessageNoticeLoadedState(netStyle);
Logger.log(netStyle.toJson().toString());
}

}

/// 下拉刷新
Stream<MessageNoticeState> _mapOnRefreshEventToState(MessageNoticeOnRefreshEvent event) async* {}


+ 39
- 6
lib/pages/message_notice_page/bloc/message_notice_repository.dart Переглянути файл

@@ -1,3 +1,6 @@
import 'dart:convert';

import 'package:zhiying_base_widget/pages/message_notice_page/model/message_notice_style_model.dart';
import 'package:zhiying_comm/util/empty_util.dart';
import 'package:zhiying_comm/util/global_config.dart';
import 'package:zhiying_comm/util/log/let_log.dart';
@@ -7,8 +10,43 @@ class MessageNoticeRepository {
final int _maxSize = 5;
int _currentPage = 1;
bool _hasMoreData = true;
MessageNoticeStyleModel _styleModel;
List<dynamic> _oldData = [];

/// 样式初始化(获取网络)
Future<MessageNoticeStyleModel> fetchNetStyle() async {
try {
var result = await NetUtil.post('/api/v1/mod/pub.flutter.message_center', cache: true, method: NetMethod.GET);
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) {
var modListData = result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list'][0]['data'];
if (!EmptyUtil.isEmpty(modListData)) {
_styleModel = MessageNoticeStyleModel.fromJson(jsonDecode(modListData.toString()));
return _styleModel;
}
}
} catch (e, s) {
Logger.error(e, s);
}
return null;
}

/// 样式初始化(获取缓存)
Future<MessageNoticeStyleModel> fetchCachedStyle() async {
try {
var result = await NetUtil.getRequestCachedData('/api/v1/mod/pub.flutter.message_center');
if (!EmptyUtil.isEmpty(result)) {
var modListData = result['mod_list'][0]['data'];
if (!EmptyUtil.isEmpty(modListData)) {
_styleModel = MessageNoticeStyleModel.fromJson(jsonDecode(modListData.toString()));
return _styleModel;
}
}
} catch (e, s) {
Logger.error(e, s);
}
return null;
}

/// 下拉刷新
Future<dynamic> fetchRefreshData() async {
return fetchInitData();
@@ -32,12 +70,7 @@ class MessageNoticeRepository {

/// 基础请求
Future<dynamic> _baseRequest() async {
try {
var result = await NetUtil.post('', params: {'size': _maxSize.toString()});
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) {
++_currentPage;
}
} catch (e, s) {
try {} catch (e, s) {
Logger.error(e, s);
}
return null;


+ 15
- 1
lib/pages/message_notice_page/bloc/message_notice_state.dart Переглянути файл

@@ -10,13 +10,27 @@ abstract class MessageNoticeState extends Equatable {
class MessageNoticeInitial extends MessageNoticeState {}

/// 数据加载成功
class MessageNoticeLoadedState extends MessageNoticeState {}
class MessageNoticeLoadedState extends MessageNoticeState {
MessageNoticeStyleModel styleModel;
MessageNoticeLoadedState(this.styleModel);

@override
List<Object> get props => [this.styleModel];
}

/// 初始化失败
class MessageNoticeInitErrorState extends MessageNoticeState{}

/// 下拉刷新失败
class MessageNoticeOnRefreshErrorState extends MessageNoticeState {}

/// 下拉刷新成功
class MessageNoticeOnRefreshSuccessState extends MessageNoticeState{}

/// 上拉更多失败
class MessageNoticeOnLoadErrorState extends MessageNoticeState {}

/// 上拉更多成功
class MessageNoticeOnLoadSuccessState extends MessageNoticeState{}
/// 数据初始化加载失败
class MessageNoticeErrorState extends MessageNoticeState {}

+ 211
- 79
lib/pages/message_notice_page/message_notice_page.dart Переглянути файл

@@ -1,10 +1,14 @@
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/widgets/empty/empty_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

import 'model/message_notice_style_model.dart';

///
/// 消息通知页
///
@@ -16,7 +20,7 @@ class MessageNoticePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider<MessageNoticeBloc>(
create: (_) => MessageNoticeBloc(MessageNoticeRepository())..add(MessageNoticeInitEvent()),
create: (_) => MessageNoticeBloc(MessageNoticeRepository()),
child: _MessageNoticePageContainer(),
);
}
@@ -28,33 +32,129 @@ class _MessageNoticePageContainer extends StatefulWidget {
}

class __MessageNoticePageContainerState extends State<_MessageNoticePageContainer> {
RefreshController _refreshController;

/// 刷新
void _onRefresh() async {}

/// 下拉更多
void _onLoad() async {}

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

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

@override
Widget build(BuildContext context) {
return _buildMainWidget();
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);
}

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

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

/// 主视图
Widget _buildMainWidget() {
/// 有数据
Widget _buildDataListWidget(MessageNoticeStyleModel styleModel) {
return Scaffold(
appBar: _buildAppBarWidget(),
backgroundColor: HexColor.fromHex('#F9F9F9'),
body: ListView.builder(
appBar: _buildAppBarWidget(),
body: SmartRefresher(
controller: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoad,
enablePullDown: true,
enablePullUp: true,
child: ListView.builder(
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8),
// shrinkWrap: true,
itemCount: 5,
itemCount: styleModel?.main_notification?.length ?? 0,
itemBuilder: (context, index) {
return _buildOfficialActivitiesStyleWidget();
}));
return _buildMessageCenterStyleWidget(styleModel?.main_notification[index], index, styleModel?.main_notification?.length);
}),
),
);
}

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

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

/// 消息中心样式
Widget _buildMessageCenterStyleWidget(int index, int length) {
Widget _buildMessageCenterStyleWidget(MainNotificationStyle styleModel, int index, int length) {
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 Container(
decoration: BoxDecoration(color: HexColor.fromHex('#FFFFFF'), borderRadius: borderRadius),
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>[
@@ -63,7 +163,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
width: double.infinity,
child: Row(
children: <Widget>[
_buildCustomerAvatarWidget(),
_buildCustomerAvatarWidget(icon: styleModel?.icon),
const SizedBox(width: 10),
Expanded(
child: Column(
@@ -73,8 +173,11 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('官方活动', style: TextStyle(color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold, fontSize: 13)),
Text('04-20 16:00', style: TextStyle(color: HexColor.fromHex('#D8D8D8'), fontSize: 12)),
Text(
styleModel?.name ?? '官方活动',
style: TextStyle(color: HexColor.fromHex(styleModel?.name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 13),
),
Text('04-20 16:00', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)),
],
),
Padding(
@@ -83,7 +186,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
'2020年6月23日4:00至6月30日4:00关闭提现aaa',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 12),
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12),
),
),
],
@@ -99,12 +202,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
}

/// 官方通知样式
Widget _buildOfficialNoticeStyleWidget() {
Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel) {
return 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('#FFFFFF'),
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
borderRadius: BorderRadius.circular(7.5),
),
child: Column(
@@ -113,19 +216,26 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildCustomerAvatarWidget(),
_buildCustomerAvatarWidget(icon: styleModel?.icon),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text('关于关闭提现功能通知', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
Text(
'关于关闭提现功能通知',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
),
const SizedBox(height: 5),

/// 内容
Text('由于微信官方的限制,我们暂时将嗨如意小程序内的提现功能进行关闭并进行维护,关闭功能时间为2020年6月23日4:00至6月30日4:00,请谅解',
maxLines: 3, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11))
Text(
'由于微信官方的限制,我们暂时将嗨如意小程序内的提现功能进行关闭并进行维护,关闭功能时间为2020年6月23日4:00至6月30日4:00,请谅解',
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
)
],
),
)
@@ -133,25 +243,30 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
),

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

/// 官方活动样式
Widget _buildOfficialActivitiesStyleWidget() {
Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel) {
return 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('#FFFFFF')),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF')),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text(
'8.8淘宝会员节大促',
style: TextStyle(color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold, fontSize: 14),
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -159,8 +274,11 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine

/// 图片海报
ClipRRect(
borderRadius: BorderRadius.circular(7.5),
child: CachedNetworkImage(imageUrl: 'http://ossq.izhyin.cn/index_carousel_1.png', width: double.infinity, )),
borderRadius: BorderRadius.circular(7.5),
child: CachedNetworkImage(
imageUrl: 'http://ossq.izhyin.cn/index_carousel_1.png',
width: double.infinity,
)),
const SizedBox(height: 6.5),

/// 活动内容
@@ -168,24 +286,24 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
'京东家电815周年庆,全场家电最低五折起,买一送一等超多优惠活动,点击查看活动详情',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999')),
style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')),
),

/// 时间
const SizedBox(height: 7),
Text('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex('#D8D8D8'), fontSize: 11))
Text('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))
],
),
);
}

/// 交易通知样式
Widget _buildTradeNoticeStyleWidget() {
Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel) {
return 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('#FFFFFF'),
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
borderRadius: BorderRadius.circular(7.5),
),
child: Column(
@@ -194,18 +312,18 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildCustomerAvatarWidget(),
_buildCustomerAvatarWidget(icon: styleModel?.icon),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text('自购订单收益', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
Text('自购订单收益', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
const SizedBox(height: 5),

/// 内容
_buildCustomerTradeContentWidget(),
_buildCustomerTradeContentWidget(styleModel),
],
),
)
@@ -213,19 +331,21 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
),

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

/// 推广通知样式
Widget _buildPromoteNoticeStyleWidget() {
Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel) {
return 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('#FFFFFF'),
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
borderRadius: BorderRadius.circular(7.5),
),
child: Column(
@@ -234,19 +354,26 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildCustomerAvatarWidget(),
_buildCustomerAvatarWidget(icon: styleModel?.icon),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text('新增直推粉丝', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
Text(
'新增直推粉丝',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
),
const SizedBox(height: 5),

/// 内容
Text('恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!',
maxLines: 3, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11))
Text(
'恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!',
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
)
],
),
)
@@ -254,19 +381,21 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
),

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

/// 反馈通知样式
Widget _buildFeedbackNoticeStyleWidget() {
Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel) {
return 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('#FFFFFF'),
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'),
borderRadius: BorderRadius.circular(7.5),
),
child: Column(
@@ -275,18 +404,18 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildCustomerAvatarWidget(),
_buildCustomerAvatarWidget(icon: styleModel?.icon),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// 标题
Text('您的反馈有回复啦', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
Text('您的反馈有回复啦', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
const SizedBox(height: 3),

/// 内容
Text('点击查看回复详情',
maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11))
Text('点击查看回复详情', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11))
],
),
)
@@ -294,7 +423,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
),

/// 时间
Padding(padding: const EdgeInsets.only(top: 16), child: Text('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex('#D8D8D8'), fontSize: 11)))
Padding(padding: const EdgeInsets.only(top: 16), child: Text(styleModel?.time_color ?? '2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex('#D8D8D8'), fontSize: 11)))
],
),
);
@@ -322,7 +451,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
}

/// ================================= 自定义View ================================= ///
Widget _buildCustomerAvatarWidget() {
Widget _buildCustomerAvatarWidget({@required String icon, String value}) {
return Container(
// width: 30,
// height: 30,
@@ -334,21 +463,26 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
Container(
height: 30,
width: 30,
color: Colors.deepPurpleAccent,
child: CachedNetworkImage(
imageUrl: icon ?? '',
),
),
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('#FF4242'), borderRadius: BorderRadius.circular(6), border: Border.all(color: HexColor.fromHex('#FFFFFF'), width: 0.5)),
child: Text(
'18',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 9, color: HexColor.fromHex('#FFFFFF')),
Visibility(
visible: !EmptyUtil.isEmpty(value),
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('#FF4242'), borderRadius: BorderRadius.circular(6), border: Border.all(color: HexColor.fromHex('#FFFFFF'), width: 0.5)),
child: Text(
'18',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 9, color: HexColor.fromHex('#FFFFFF')),
),
),
),
)
@@ -357,26 +491,24 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
);
}

Widget _buildCustomerTradeContentWidget(){
Map<String, String> datas= {
'订单编号:':'154547896541651464788',
'订单类型:':'京东',
Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel) {
Map<String, String> datas = {
'订单编号:': '154547896541651464788',
'订单类型:': '京东',
'预估收益:': '8.00',
'下单时间:':'2020-08-14 11:35:39',
'预估结算:':'次月25日结算',
'下单时间:': '2020-08-14 11:35:39',
'预估结算:': '次月25日结算',
};
List<Widget> lists = [];
datas.forEach((key, value) {
datas.forEach((key, value) {
lists.add(Padding(
padding: const EdgeInsets.only(bottom: 5),
child: RichText(
textAlign: TextAlign.start,
text: TextSpan(
children: [
TextSpan(text: key, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))),
TextSpan(text: value, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))),
]
),
text: TextSpan(children: [
TextSpan(text: key, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))),
TextSpan(text: value, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))),
]),
),
));
});


+ 311
- 0
lib/pages/message_notice_page/model/message_notice_style_model.dart Переглянути файл

@@ -0,0 +1,311 @@
class MessageNoticeStyleModel {
String app_bar_bg_color;
String app_bar_bg_img;
String app_bar_name;
String app_bar_name_color;
List<MainNotificationStyle> main_notification;
FeedbackNotificationStyle feedback_notification;
OfficialActivityStyle official_activity;
OfficialNotificationStyle official_notification;
PromotionNotificationStyle promotion_notification;
TransactionNotificationStyle transaction_notification;

MessageNoticeStyleModel({
this.app_bar_bg_color,
this.app_bar_bg_img,
this.app_bar_name,
this.app_bar_name_color,
this.feedback_notification,
this.main_notification,
this.official_activity,
this.official_notification,
this.promotion_notification,
this.transaction_notification,
});

factory MessageNoticeStyleModel.fromJson(Map<String, dynamic> json) {
return MessageNoticeStyleModel(
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'],
app_bar_name_color: json['app_bar_name_color'],
feedback_notification: json['feedback_notification'] != null ? FeedbackNotificationStyle.fromJson(json['feedback_notification']) : null,
main_notification: json['main'] != null ? (json['main'] as List).map((i) => MainNotificationStyle.fromJson(i)).toList() : null,
official_activity: json['official_activity'] != null ? OfficialActivityStyle.fromJson(json['official_activity']) : null,
official_notification: json['official_notification'] != null ? OfficialNotificationStyle.fromJson(json['official_notification']) : null,
promotion_notification: json['promotion_notification'] != null ? PromotionNotificationStyle.fromJson(json['promotion_notification']) : null,
transaction_notification: json['transaction_notification'] != null ? TransactionNotificationStyle.fromJson(json['transaction_notification']) : null,
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['app_bar_bg_color'] = this.app_bar_bg_color;
data['app_bar_bg_img'] = this.app_bar_bg_img;
data['app_bar_name'] = this.app_bar_name;
data['app_bar_name_color'] = this.app_bar_name_color;
if (this.feedback_notification != null) {
data['feedback_notification'] = this.feedback_notification.toJson();
}
if (this.main_notification != null) {
data['main'] = this.main_notification.map((v) => v.toJson()).toList();
}
if (this.official_activity != null) {
data['official_activity'] = this.official_activity.toJson();
}
if (this.official_notification != null) {
data['official_notification'] = this.official_notification.toJson();
}
if (this.promotion_notification != null) {
data['promotion_notification'] = this.promotion_notification.toJson();
}
if (this.transaction_notification != null) {
data['transaction_notification'] = this.transaction_notification.toJson();
}
return data;
}
}

class FeedbackNotificationStyle {
String bg_color;
String icon;
String message_value_color;
String skip_identifier;
String time_color;
String title_value_color;

FeedbackNotificationStyle({
this.bg_color,
this.icon,
this.message_value_color,
this.skip_identifier,
this.time_color,
this.title_value_color,
});

factory FeedbackNotificationStyle.fromJson(Map<String, dynamic> json) {
return FeedbackNotificationStyle(
bg_color: json['bg_color'],
icon: json['icon'],
message_value_color: json['message_value_color'],
skip_identifier: json['skip_identifier'],
time_color: json['time_color'],
title_value_color: json['title_value_color'],
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_color'] = this.bg_color;
data['icon'] = this.icon;
data['message_value_color'] = this.message_value_color;
data['skip_identifier'] = this.skip_identifier;
data['time_color'] = this.time_color;
data['title_value_color'] = this.title_value_color;
return data;
}
}

class MainNotificationStyle {
String bg_color;
String icon;
String name;
String name_color;
String time_color;
String type;
String value_color;

MainNotificationStyle({
this.bg_color,
this.icon,
this.name,
this.name_color,
this.time_color,
this.type,
this.value_color,
});

factory MainNotificationStyle.fromJson(Map<String, dynamic> json) {
return MainNotificationStyle(
bg_color: json['bg_color'],
icon: json['icon'],
name: json['name'],
name_color: json['name_color'],
time_color: json['time_color'],
type: json['type'],
value_color: json['value_color'],
);
}

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

class OfficialActivityStyle {
String bg_color;
String message_value_color;
String skip_identifier;
String time_color;
String title_value_color;

OfficialActivityStyle({
this.bg_color,
this.message_value_color,
this.skip_identifier,
this.time_color,
this.title_value_color,
});

factory OfficialActivityStyle.fromJson(Map<String, dynamic> json) {
return OfficialActivityStyle(
bg_color: json['bg_color'],
message_value_color: json['message_value_color'],
skip_identifier: json['skip_identifier'],
time_color: json['time_color'],
title_value_color: json['title_value_color'],
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_color'] = this.bg_color;
data['message_value_color'] = this.message_value_color;
data['skip_identifier'] = this.skip_identifier;
data['time_color'] = this.time_color;
data['title_value_color'] = this.title_value_color;
return data;
}
}

class OfficialNotificationStyle {
String bg_color;
String icon;
String message_value_color;
String skip_identifier;
String time_color;
String title_value_color;

OfficialNotificationStyle({
this.bg_color,
this.icon,
this.message_value_color,
this.skip_identifier,
this.time_color,
this.title_value_color,
});

factory OfficialNotificationStyle.fromJson(Map<String, dynamic> json) {
return OfficialNotificationStyle(
bg_color: json['bg_color'],
icon: json['icon'],
message_value_color: json['message_value_color'],
skip_identifier: json['skip_identifier'],
time_color: json['time_color'],
title_value_color: json['title_value_color'],
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_color'] = this.bg_color;
data['icon'] = this.icon;
data['message_value_color'] = this.message_value_color;
data['skip_identifier'] = this.skip_identifier;
data['time_color'] = this.time_color;
data['title_value_color'] = this.title_value_color;
return data;
}
}

class PromotionNotificationStyle {
String bg_color;
String icon;
String message_value_color;
String skip_identifier;
String time_color;
String title_value_color;

PromotionNotificationStyle({
this.bg_color,
this.icon,
this.message_value_color,
this.skip_identifier,
this.time_color,
this.title_value_color,
});

factory PromotionNotificationStyle.fromJson(Map<String, dynamic> json) {
return PromotionNotificationStyle(
bg_color: json['bg_color'],
icon: json['icon'],
message_value_color: json['message_value_color'],
skip_identifier: json['skip_identifier'],
time_color: json['time_color'],
title_value_color: json['title_value_color'],
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_color'] = this.bg_color;
data['icon'] = this.icon;
data['message_value_color'] = this.message_value_color;
data['skip_identifier'] = this.skip_identifier;
data['time_color'] = this.time_color;
data['title_value_color'] = this.title_value_color;
return data;
}
}

class TransactionNotificationStyle {
String bg_color;
String earnings;
String icon;
String message_value_color;
String skip_identifier;
String time_color;
String title_value_color;

TransactionNotificationStyle({
this.bg_color,
this.earnings,
this.icon,
this.message_value_color,
this.skip_identifier,
this.time_color,
this.title_value_color,
});

factory TransactionNotificationStyle.fromJson(Map<String, dynamic> json) {
return TransactionNotificationStyle(
bg_color: json['bg_color'],
earnings: json['earnings'],
icon: json['icon'],
message_value_color: json['message_value_color'],
skip_identifier: json['skip_identifier'],
time_color: json['time_color'],
title_value_color: json['title_value_color'],
);
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bg_color'] = this.bg_color;
data['earnings'] = this.earnings;
data['icon'] = this.icon;
data['message_value_color'] = this.message_value_color;
data['skip_identifier'] = this.skip_identifier;
data['time_color'] = this.time_color;
data['title_value_color'] = this.title_value_color;
return data;
}
}

+ 3
- 3
lib/pages/search_result_page/item/search_result_item_page.dart Переглянути файл

@@ -124,9 +124,9 @@ class _SearchResultItemPageContianerState extends State<SearchResultItemPageCont

/// 获取主视图
Widget _getMainWidget(List<Map<String, dynamic>> datas) {
return Scaffold(
backgroundColor: HexColor.fromHex('#F9F9F9'),
body: Listener(
return Container(
color: HexColor.fromHex('#F9F9F9'),
child: Listener(
onPointerDown: (down) => RouterUtil.hideKeyboard(context),
child: Stack(
children: <Widget>[


+ 13
- 2
lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart Переглянути файл

@@ -107,10 +107,14 @@ class _SearchResultGoodsListWidgetContainerState extends State<SearchResultGoods
}
if (state is SearchResultGoodsListChangeStyleState) {
_isShowOneColumn = state.isShowOneColumn;
return _getMainWidget(state?.model, widget?.style);
if(!EmptyUtil.isEmpty(state?.model)) {
return _getMainWidget(state?.model, widget?.style);
}else{
return _getEmptyWidget();
}
}
if (state is SearchResultGoodsListInitErrorState){
return SliverPadding(padding: const EdgeInsets.only(top: 80), sliver: SliverToBoxAdapter(child: EmptyWidget()));
return _getEmptyWidget();
}
return SliverToBoxAdapter(child: HomeGoodsSkeleton());
},
@@ -188,4 +192,11 @@ class _SearchResultGoodsListWidgetContainerState extends State<SearchResultGoods
// }
// });
}


/// 空视图
Widget _getEmptyWidget(){
return SliverPadding(padding: const EdgeInsets.only(top: 80), sliver: SliverToBoxAdapter(child: EmptyWidget()));
}

}

+ 21
- 18
lib/widgets/search_result/tarbar/search_result_tab_widget.dart Переглянути файл

@@ -187,25 +187,28 @@ class _SearchResultTabWidgetState extends State<SearchResultTabWidget> {

/// 联想列表
Widget _getThinkListWidget(List<SearchThinkModel> model){
return Container(
height: double.infinity,
color: Colors.white,
child: ListView.builder(itemBuilder: (context, index){
SearchThinkModel item = model[index];
return GestureDetector(
onTap: ()=> _onThinkItemClick(item),
child: Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(width: 0.5, color: HexColor.fromHex('#EEEEEE')))
return Listener(
onPointerDown: (down)=> RouterUtil.hideKeyboard(context),
child: Container(
height: double.infinity,
color: Colors.white,
child: ListView.builder(itemBuilder: (context, index){
SearchThinkModel item = model[index];
return GestureDetector(
onTap: ()=> _onThinkItemClick(item),
child: Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(width: 0.5, color: HexColor.fromHex('#EEEEEE')))
),
padding: const EdgeInsets.only(top: 13, bottom: 13),
child: Text('${item?.keywords}', style: TextStyle( color: HexColor.fromHex('#333333'), fontSize: 14),),
),
padding: const EdgeInsets.only(top: 13, bottom: 13),
child: Text('${item?.keywords}', style: TextStyle( color: HexColor.fromHex('#333333'), fontSize: 14),),
),
);
},
itemCount: model?.length ?? 0,
padding: const EdgeInsets.only(left: 12.5, right: 12.5),
shrinkWrap: true,
);
},
itemCount: model?.length ?? 0,
padding: const EdgeInsets.only(left: 12.5, right: 12.5),
shrinkWrap: true,
),
),
);
}


Завантаження…
Відмінити
Зберегти