@@ -113,7 +113,8 @@ class _SearchItemPageContainerState extends State<SearchItemPageContainer> { | |||||
} else { | } else { | ||||
list.add(SliverToBoxAdapter( | list.add(SliverToBoxAdapter( | ||||
/// TODO 改成骨架图 | /// TODO 改成骨架图 | ||||
child: Container(child: Text('暂无数据~')), | |||||
// child: Container(child: Text('暂无数据~')), | |||||
child: Container(), | |||||
)); | )); | ||||
} | } | ||||
return list; | return list; | ||||
@@ -15,15 +15,15 @@ class GoodsDetailCommendCreater extends WidgetCreater { | |||||
@override | @override | ||||
List<Widget> createWidgets(Map<String, dynamic> model) { | List<Widget> createWidgets(Map<String, dynamic> model) { | ||||
String d = model['data']; | |||||
Map<String, dynamic> json = convert.jsonDecode(d); | |||||
GoodsDetailRecommendModel style = GoodsDetailRecommendModel.fromJson(json); | |||||
// String d = model['data']; | |||||
// Map<String, dynamic> json = convert.jsonDecode(d); | |||||
// GoodsDetailRecommendModel style = GoodsDetailRecommendModel.fromJson(json); | |||||
print('创建商品列表'); | |||||
Widget _widget = BlocProvider<HomeGoodsHeaderBloc>( | |||||
bloc: HomeGoodsHeaderBloc(), | |||||
child: HomeGoodsHeader(model, _eventBus), | |||||
); | |||||
// print('创建商品列表'); | |||||
// Widget _widget = BlocProvider<HomeGoodsHeaderBloc>( | |||||
// bloc: HomeGoodsHeaderBloc(), | |||||
// child: HomeGoodsHeader(model, _eventBus), | |||||
// ); | |||||
return [ | return [ | ||||
SliverToBoxAdapter( | SliverToBoxAdapter( | ||||
@@ -3,37 +3,46 @@ import 'dart:convert' as convert; | |||||
import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
import 'package:flutter/material.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/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'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
class GoodsDetailsRecommendWidget extends StatefulWidget { | class GoodsDetailsRecommendWidget extends StatefulWidget { | ||||
final Map<String, dynamic> data; | final Map<String, dynamic> data; | ||||
const GoodsDetailsRecommendWidget(this.data, {Key key}) : super(key: key); | |||||
// Map<String, dynamic> 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 | @override | ||||
_GoodsDetailsRecommendWidgetState createState() => | |||||
_GoodsDetailsRecommendWidgetState(); | |||||
_GoodsDetailsRecommendWidgetState createState() => _GoodsDetailsRecommendWidgetState(); | |||||
} | } | ||||
class _GoodsDetailsRecommendWidgetState | |||||
extends State<GoodsDetailsRecommendWidget> { | |||||
GoodsDetailRecommendModel _style; | |||||
class _GoodsDetailsRecommendWidgetState extends State<GoodsDetailsRecommendWidget> { | |||||
// GoodsDetailRecommendModel _style; | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
String d = widget.data['data']; | |||||
Map<String, dynamic> json = convert.jsonDecode(d); | |||||
_style = GoodsDetailRecommendModel.fromJson(json); | |||||
// String d = widget.data['data']; | |||||
// Map<String, dynamic> json = convert.jsonDecode(d); | |||||
// _style = GoodsDetailRecommendModel.fromJson(json); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Column( | |||||
children: <Widget>[ | |||||
_createTitle(), | |||||
], | |||||
return Container( | |||||
child: Column( | |||||
children: <Widget>[ | |||||
_createTitle(), | |||||
], | |||||
), | |||||
); | ); | ||||
} | } | ||||
@@ -46,17 +55,24 @@ class _GoodsDetailsRecommendWidgetState | |||||
mainAxisAlignment: MainAxisAlignment.center, | mainAxisAlignment: MainAxisAlignment.center, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
CachedNetworkImage( | CachedNetworkImage( | ||||
imageUrl: _style.recListIcon ?? '', | |||||
// imageUrl: _style.recListIcon ?? '', | |||||
// imageUrl: widget?.style['rec_icon'] ?? '', | |||||
imageUrl: widget?.styleModel?.recIcon ?? '', | |||||
width: 15, | width: 15, | ||||
height: 15, | height: 15, | ||||
), | ), | ||||
Padding( | Padding( | ||||
padding: const EdgeInsets.only(left: 2.5), | padding: const EdgeInsets.only(left: 2.5), | ||||
child: Text( | child: Text( | ||||
_style.recListText, | |||||
// _style?.recListText ?? '', | |||||
// widget?.style['title'] ?? '', | |||||
widget?.styleModel?.title ?? '', | |||||
style: TextStyle( | 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, | |||||
), | |||||
), | ), | ||||
) | ) | ||||
], | ], | ||||
@@ -15,19 +15,27 @@ class HomeGoodsStyleModel { | |||||
String listColumn; | String listColumn; | ||||
HomeGoodsListStyleModel listStyle; | 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<String, dynamic> json) { | HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) { | ||||
topMargin = json['top_margin']; | topMargin = json['top_margin']; | ||||
@@ -46,9 +54,10 @@ class HomeGoodsStyleModel { | |||||
}); | }); | ||||
} | } | ||||
listColumn = json['list_column']; | 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<String, dynamic> toJson() { | Map<String, dynamic> toJson() { | ||||
@@ -63,13 +72,15 @@ class HomeGoodsStyleModel { | |||||
data['subtitle_bg_color'] = this.subtitleBgColor; | data['subtitle_bg_color'] = this.subtitleBgColor; | ||||
data['source_type'] = this.sourceType; | data['source_type'] = this.sourceType; | ||||
if (this.recommendList != null) { | 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; | data['list_column'] = this.listColumn; | ||||
if (this.listStyle != null) { | if (this.listStyle != null) { | ||||
data['list_style'] = this.listStyle.toJson(); | data['list_style'] = this.listStyle.toJson(); | ||||
} | } | ||||
data['title'] = this.title; | |||||
data['title_color'] = this.titleColor; | |||||
data['rec_icon'] = this.recIcon; | |||||
return data; | return data; | ||||
} | } | ||||
} | } |
@@ -469,6 +469,8 @@ class _SearchResultSortWidgetState extends State<SearchResultSortWidget> { | |||||
decoration: InputDecoration( | decoration: InputDecoration( | ||||
filled: true, | filled: true, | ||||
fillColor: Colors.transparent, | fillColor: Colors.transparent, | ||||
isDense: true, | |||||
contentPadding: EdgeInsets.zero, | |||||
// contentPadding: const EdgeInsets.only(bottom: 6, left: ), | // contentPadding: const EdgeInsets.only(bottom: 6, left: ), | ||||
border: InputBorder.none, | border: InputBorder.none, | ||||
focusedBorder: InputBorder.none, | focusedBorder: InputBorder.none, | ||||