diff --git a/lib/pages/search_page/item/search_item_page.dart b/lib/pages/search_page/item/search_item_page.dart index 683e487..659e39f 100644 --- a/lib/pages/search_page/item/search_item_page.dart +++ b/lib/pages/search_page/item/search_item_page.dart @@ -113,7 +113,8 @@ class _SearchItemPageContainerState extends State { } else { list.add(SliverToBoxAdapter( /// TODO 改成骨架图 - child: Container(child: Text('暂无数据~')), + // child: Container(child: Text('暂无数据~')), + child: Container(), )); } return list; diff --git a/lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart b/lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart index f0285c8..9198f34 100644 --- a/lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart +++ b/lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart @@ -15,15 +15,15 @@ class GoodsDetailCommendCreater extends WidgetCreater { @override List createWidgets(Map model) { - String d = model['data']; - Map json = convert.jsonDecode(d); - GoodsDetailRecommendModel style = GoodsDetailRecommendModel.fromJson(json); + // String d = model['data']; + // Map json = convert.jsonDecode(d); + // GoodsDetailRecommendModel style = GoodsDetailRecommendModel.fromJson(json); - print('创建商品列表'); - Widget _widget = BlocProvider( - bloc: HomeGoodsHeaderBloc(), - child: HomeGoodsHeader(model, _eventBus), - ); + // print('创建商品列表'); + // Widget _widget = BlocProvider( + // bloc: HomeGoodsHeaderBloc(), + // child: HomeGoodsHeader(model, _eventBus), + // ); return [ SliverToBoxAdapter( diff --git a/lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart b/lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart index 156c48d..a1b5135 100644 --- a/lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart +++ b/lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart @@ -3,37 +3,46 @@ import 'dart:convert' as convert; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/widgets/goods_details/recommend/models/goods_detail_recommend_model.dart'; +import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class GoodsDetailsRecommendWidget extends StatefulWidget { final Map data; - - const GoodsDetailsRecommendWidget(this.data, {Key key}) : super(key: key); + // Map style = {}; + HomeGoodsStyleModel styleModel; + + GoodsDetailsRecommendWidget(this.data, {Key key}) : super(key: key) { + try { + styleModel = HomeGoodsStyleModel.fromJson(convert.jsonDecode(data['data'])); + } catch (e, s) { + Logger.error(e, s); + } + } @override - _GoodsDetailsRecommendWidgetState createState() => - _GoodsDetailsRecommendWidgetState(); + _GoodsDetailsRecommendWidgetState createState() => _GoodsDetailsRecommendWidgetState(); } -class _GoodsDetailsRecommendWidgetState - extends State { - GoodsDetailRecommendModel _style; +class _GoodsDetailsRecommendWidgetState extends State { + // GoodsDetailRecommendModel _style; @override void initState() { - String d = widget.data['data']; - Map json = convert.jsonDecode(d); - _style = GoodsDetailRecommendModel.fromJson(json); + // String d = widget.data['data']; + // Map json = convert.jsonDecode(d); + // _style = GoodsDetailRecommendModel.fromJson(json); super.initState(); } @override Widget build(BuildContext context) { - return Column( - children: [ - _createTitle(), - ], + return Container( + child: Column( + children: [ + _createTitle(), + ], + ), ); } @@ -46,17 +55,24 @@ class _GoodsDetailsRecommendWidgetState mainAxisAlignment: MainAxisAlignment.center, children: [ CachedNetworkImage( - imageUrl: _style.recListIcon ?? '', + // imageUrl: _style.recListIcon ?? '', + // imageUrl: widget?.style['rec_icon'] ?? '', + imageUrl: widget?.styleModel?.recIcon ?? '', width: 15, height: 15, ), Padding( padding: const EdgeInsets.only(left: 2.5), child: Text( - _style.recListText, + // _style?.recListText ?? '', + // widget?.style['title'] ?? '', + widget?.styleModel?.title ?? '', style: TextStyle( - color: HexColor.fromHex(_style?.recListTextColor ?? 'FF4242'), - fontSize: 14), + // color: HexColor.fromHex(_style?.recListTextColor ?? 'FF4242'), + // color: HexColor.fromHex(widget?.style['title_color'] ?? ''), + color: HexColor.fromHex(widget?.styleModel?.titleColor ?? ''), + fontSize: 14, + ), ), ) ], diff --git a/lib/widgets/home/home_goods/models/home_goods_style_model.dart b/lib/widgets/home/home_goods/models/home_goods_style_model.dart index f44d74d..c789e83 100644 --- a/lib/widgets/home/home_goods/models/home_goods_style_model.dart +++ b/lib/widgets/home/home_goods/models/home_goods_style_model.dart @@ -15,19 +15,27 @@ class HomeGoodsStyleModel { String listColumn; HomeGoodsListStyleModel listStyle; - HomeGoodsStyleModel( - {this.topMargin, - this.leftRighMargin, - this.subtitle, - this.tilteTextColor, - this.subtitleTextColor, - this.tilteTextSelectedColor, - this.subtitleTextSelectedColor, - this.subtitleBgColor, - this.sourceType, - this.recommendList, - this.listColumn, - this.listStyle}); + String title; + String titleColor; + String recIcon; + + HomeGoodsStyleModel({ + this.topMargin, + this.leftRighMargin, + this.subtitle, + this.tilteTextColor, + this.subtitleTextColor, + this.tilteTextSelectedColor, + this.subtitleTextSelectedColor, + this.subtitleBgColor, + this.sourceType, + this.recommendList, + this.listColumn, + this.listStyle, + this.title, + this.titleColor, + this.recIcon, + }); HomeGoodsStyleModel.fromJson(Map json) { topMargin = json['top_margin']; @@ -46,9 +54,10 @@ class HomeGoodsStyleModel { }); } listColumn = json['list_column']; - listStyle = json['list_style'] != null - ? new HomeGoodsListStyleModel.fromJson(json['list_style']) - : null; + listStyle = json['list_style'] != null ? new HomeGoodsListStyleModel.fromJson(json['list_style']) : null; + title = json['title']; + titleColor = json['title_color']; + recIcon = json['rec_icon']; } Map toJson() { @@ -63,13 +72,15 @@ class HomeGoodsStyleModel { data['subtitle_bg_color'] = this.subtitleBgColor; data['source_type'] = this.sourceType; if (this.recommendList != null) { - data['recommend_list'] = - this.recommendList.map((v) => v.toJson()).toList(); + data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList(); } data['list_column'] = this.listColumn; if (this.listStyle != null) { data['list_style'] = this.listStyle.toJson(); } + data['title'] = this.title; + data['title_color'] = this.titleColor; + data['rec_icon'] = this.recIcon; return data; } } diff --git a/lib/widgets/search_result/sort/search_result_sort_widget.dart b/lib/widgets/search_result/sort/search_result_sort_widget.dart index 1b6d41a..c40c0bd 100644 --- a/lib/widgets/search_result/sort/search_result_sort_widget.dart +++ b/lib/widgets/search_result/sort/search_result_sort_widget.dart @@ -469,6 +469,8 @@ class _SearchResultSortWidgetState extends State { decoration: InputDecoration( filled: true, fillColor: Colors.transparent, + isDense: true, + contentPadding: EdgeInsets.zero, // contentPadding: const EdgeInsets.only(bottom: 6, left: ), border: InputBorder.none, focusedBorder: InputBorder.none,