Pārlūkot izejas kodu

1、商品详情列表的优化

2、搜索结果页筛选输入框的优化
tags/0.0.1
PH2 pirms 4 gadiem
vecāks
revīzija
d7216a52ef
5 mainītis faili ar 75 papildinājumiem un 45 dzēšanām
  1. +2
    -1
      lib/pages/search_page/item/search_item_page.dart
  2. +8
    -8
      lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart
  3. +34
    -18
      lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart
  4. +29
    -18
      lib/widgets/home/home_goods/models/home_goods_style_model.dart
  5. +2
    -0
      lib/widgets/search_result/sort/search_result_sort_widget.dart

+ 2
- 1
lib/pages/search_page/item/search_item_page.dart Parādīt failu

@@ -113,7 +113,8 @@ class _SearchItemPageContainerState extends State<SearchItemPageContainer> {
} else {
list.add(SliverToBoxAdapter(
/// TODO 改成骨架图
child: Container(child: Text('暂无数据~')),
// child: Container(child: Text('暂无数据~')),
child: Container(),
));
}
return list;


+ 8
- 8
lib/widgets/goods_details/recommend/goods_detail_commend_creater.dart Parādīt failu

@@ -15,15 +15,15 @@ class GoodsDetailCommendCreater extends WidgetCreater {

@override
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 [
SliverToBoxAdapter(


+ 34
- 18
lib/widgets/goods_details/recommend/goods_detail_commend_widget.dart Parādīt failu

@@ -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<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
_GoodsDetailsRecommendWidgetState createState() =>
_GoodsDetailsRecommendWidgetState();
_GoodsDetailsRecommendWidgetState createState() => _GoodsDetailsRecommendWidgetState();
}

class _GoodsDetailsRecommendWidgetState
extends State<GoodsDetailsRecommendWidget> {
GoodsDetailRecommendModel _style;
class _GoodsDetailsRecommendWidgetState extends State<GoodsDetailsRecommendWidget> {
// GoodsDetailRecommendModel _style;

@override
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();
}

@override
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,
children: <Widget>[
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,
),
),
)
],


+ 29
- 18
lib/widgets/home/home_goods/models/home_goods_style_model.dart Parādīt failu

@@ -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<String, dynamic> 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<String, dynamic> 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;
}
}

+ 2
- 0
lib/widgets/search_result/sort/search_result_sort_widget.dart Parādīt failu

@@ -469,6 +469,8 @@ class _SearchResultSortWidgetState extends State<SearchResultSortWidget> {
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,


Notiek ielāde…
Atcelt
Saglabāt