Browse Source

1、添加右上角图标

2、商品详情请求添加pvd搜索条件
tags/0.0.13.8^0
PH2 3 years ago
parent
commit
8ad859ffb3
3 changed files with 99 additions and 151 deletions
  1. +7
    -2
      lib/pages/goods_details_page/bloc/goods_details_page_repository.dart
  2. +87
    -149
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  3. +5
    -0
      lib/widgets/home/home_goods/models/home_goods_model.dart

+ 7
- 2
lib/pages/goods_details_page/bloc/goods_details_page_repository.dart View File

@@ -49,9 +49,14 @@ class GoodsDetailsPageRepository {
try { try {
String provider = model['provider']; String provider = model['provider'];
String goodId = model['good_id']; String goodId = model['good_id'];
String pvd = model['pvd'];
if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId)) { if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId)) {
Logger.log('商品类型 = $provider, 商品ID = $goodId');
var result = await NetUtil.post('/api/v1/detail/$provider/$goodId', method: NetMethod.GET);
Logger.log('商品类型 = $provider, 商品ID = $goodId, pvd = $pvd');
String reqUrl = '/api/v1/detail/$provider/$goodId';
if(!EmptyUtil.isEmpty(pvd)) {
reqUrl = reqUrl + '?pvd=$pvd';
}
var result = await NetUtil.post(reqUrl, method: NetMethod.GET);
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) {
return _baseDataProcess(false, goodId, provider, result[GlobalConfig.HTTP_RESPONSE_KEY_DATA], null); return _baseDataProcess(false, goodId, provider, result[GlobalConfig.HTTP_RESPONSE_KEY_DATA], null);
} }


+ 87
- 149
lib/widgets/custom/multi_nav/custom_quick_entry.dart View File

@@ -22,8 +22,7 @@ class CustomQuickEntry extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocProvider<CustomQuickEntryBloc>( return BlocProvider<CustomQuickEntryBloc>(
create: (_) { create: (_) {
return CustomQuickEntryBloc(repository: CustomQuickEntryRepository())
..add(CustomQuickEntryInitEvent(model: model));
return CustomQuickEntryBloc(repository: CustomQuickEntryRepository())..add(CustomQuickEntryInitEvent(model: model));
}, },
child: _CustomQuickEntryContainer(model), child: _CustomQuickEntryContainer(model),
); );
@@ -39,8 +38,7 @@ class _CustomQuickEntryContainer extends StatefulWidget {
__CustomQuickEntryContainerState createState() => __CustomQuickEntryContainerState(); __CustomQuickEntryContainerState createState() => __CustomQuickEntryContainerState();
} }


class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
/// Icon点击事件 /// Icon点击事件
void _itemIconClick(ListStyle model) { void _itemIconClick(ListStyle model) {
print("item type = ${model.skipIdentifier}"); print("item type = ${model.skipIdentifier}");
@@ -81,9 +79,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
} }
if (state is CustomQuickEntryLoadedState) { if (state is CustomQuickEntryLoadedState) {
if (state.model.isShowCategory == "1") { if (state.model.isShowCategory == "1") {
return CustomQuickCateEntry(
model: state.model,
);
return CustomQuickCateEntry(model: state.model);
} else { } else {
return _getMainWidget(state.model); return _getMainWidget(state.model);
} }
@@ -119,6 +115,9 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>


// 图标的高度 // 图标的高度
double iconHeight = 40.0; double iconHeight = 40.0;
if (model?.isShowCornerIcon == '1') {
iconHeight = 43.5;
}
// 标题的高度 // 标题的高度
double titleHeight = 21.0; double titleHeight = 21.0;


@@ -138,16 +137,12 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
// 进度条的边距 // 进度条的边距
double barMargin = 15.0; double barMargin = 15.0;
// 总页数 // 总页数
int totalPage = totalDataSize % (totalRowSize * columSize) == 0
? totalDataSize ~/ (totalRowSize * columSize)
: (totalDataSize ~/ (totalRowSize * columSize)) + 1;
int totalPage = totalDataSize % (totalRowSize * columSize) == 0 ? totalDataSize ~/ (totalRowSize * columSize) : (totalDataSize ~/ (totalRowSize * columSize)) + 1;


Logger.log('totalPage = ' + totalPage?.toString()); Logger.log('totalPage = ' + totalPage?.toString());
// 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度 // 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度
double totalHeight = totalRowSize * (itemHeight + barMargin); double totalHeight = totalRowSize * (itemHeight + barMargin);
if (totalPage > 1 &&
!EmptyUtil.isEmpty(model?.pagination) &&
model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
if (totalPage > 1 && !EmptyUtil.isEmpty(model?.pagination) && model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
totalHeight = totalRowSize * (itemHeight + barMargin) + 8; totalHeight = totalRowSize * (itemHeight + barMargin) + 8;
} }


@@ -167,28 +162,21 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
totalHeight = totalHeight + moduleTitleHeight; totalHeight = totalHeight + moduleTitleHeight;
} }


double marginLeftRight = model?.isLeftRightMargin == "1"
? double.tryParse(model?.leftRightMargin ?? "0")
: 0;
double marginTop =
model?.isTopMargin == "1" ? double.tryParse(model?.topMargin ?? "0") : 0;
double marginLeftRight = model?.isLeftRightMargin == "1" ? double.tryParse(model?.leftRightMargin ?? "0") : 0;
double marginTop = model?.isTopMargin == "1" ? double.tryParse(model?.topMargin ?? "0") : 0;
return Container( return Container(
margin:
EdgeInsets.only(top: marginTop, left: marginLeftRight, right: marginLeftRight),
margin: EdgeInsets.only(top: marginTop, left: marginLeftRight, right: marginLeftRight),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex(model?.bgColor ?? ''), color: HexColor.fromHex(model?.bgColor ?? ''),
//color: Colors.green, //color: Colors.green,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)),
topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)),
bottomLeft:
Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight:
Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
)), )),
child: Container( child: Container(
margin:
EdgeInsets.only(top: !hasCategory ? 15 : 0, bottom: totalPage > 1 ? 8 : 0),
margin: EdgeInsets.only(top: !hasCategory ? 15 : 0, bottom: totalPage > 1 ? 8 : 0),
height: totalHeight, height: totalHeight,
// 总体高度 // 总体高度
width: double.infinity, width: double.infinity,
@@ -201,20 +189,14 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
visible: !EmptyUtil.isEmpty(model?.moduleTitleName), visible: !EmptyUtil.isEmpty(model?.moduleTitleName),
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 12.5, bottom: 10), padding: const EdgeInsets.only(left: 12.5, bottom: 10),
child: Text(model?.moduleTitleName ?? '',
style: TextStyle(
color: HexColor.fromHex(model?.moduleTitleColor),
fontWeight: FontWeight.bold,
fontSize: 15))),
child: Text(model?.moduleTitleName ?? '', style: TextStyle(color: HexColor.fromHex(model?.moduleTitleColor), fontWeight: FontWeight.bold, fontSize: 15))),
), ),


// icon // icon
Expanded( Expanded(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: hasCategory
? totalHeight - categoryHeight - categoryBottomMargin
: totalHeight,
height: hasCategory ? totalHeight - categoryHeight - categoryBottomMargin : totalHeight,
child: Swiper( child: Swiper(
controller: _controller, controller: _controller,
itemCount: totalPage, itemCount: totalPage,
@@ -237,9 +219,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
), ),
); );
}, },
pagination: totalPage <= 1
? null
: _getSwiperPaginationContorl(model, totalPage),
pagination: totalPage <= 1 ? null : _getSwiperPaginationContorl(model, totalPage),
), ),
), ),
) )
@@ -310,15 +290,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>


/// 页的数据 /// 页的数据
Widget _getPageWidget( Widget _getPageWidget(
{double titleHeight,
double iconHeight,
int totalPage,
int currentPage,
int columSize,
int totalRowSize,
int totalDataSize,
CustomQuickEntryModel model,
double itemHeight}) {
{double titleHeight, double iconHeight, int totalPage, int currentPage, int columSize, int totalRowSize, int totalDataSize, CustomQuickEntryModel model, double itemHeight}) {
List rowList = []; List rowList = [];
for (int i = 0; i < totalRowSize; i++) { for (int i = 0; i < totalRowSize; i++) {
rowList.add(i); rowList.add(i);
@@ -404,8 +376,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
// currentColum + currentRow * columSize; // currentColum + currentRow * columSize;


// 当前元素的下表 = 当前的列数 + 当前的行数 * 列数 + 当前的页数 * 当前的行数 + 当前的列数 // 当前元素的下表 = 当前的列数 + 当前的行数 * 列数 + 当前的页数 * 当前的行数 + 当前的列数
int currentIndex =
currentColum + currentRow * columSize + currentPage * totalRowSize * columSize;
int currentIndex = currentColum + currentRow * columSize + currentPage * totalRowSize * columSize;


// print('current Index sss = $currentIndex'); // print('current Index sss = $currentIndex');


@@ -422,17 +393,29 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
_itemIconClick(item); _itemIconClick(item);
},
},
child: Container( child: Container(
padding: EdgeInsets.only(top: model?.isShowCornerIcon == '1' ? 3 : 0),
height: itemHeight, height: itemHeight,
width: 60, width: 60,
// color: Colors.red, // color: Colors.red,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
/// 图标 /// 图标
MyNetWorkImage(
item.img,
width: 40,
Stack(
children: [
/// 图标
Center(
child: MyNetWorkImage(
item.img,
width: 40,
),
),
/// 小角标
Visibility(
visible: model?.isShowCornerIcon == '1',
child: Align(alignment: Alignment.topRight, child: Transform.translate( offset: Offset(7, -3) ,child: MyNetWorkImage(item?.rightIcon, width: 30))))
],
), ),


/// 一级标题 /// 一级标题
@@ -442,22 +425,19 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
padding: const EdgeInsets.only(top: 5), padding: const EdgeInsets.only(top: 5),
child: Text( child: Text(
item?.title ?? '', item?.title ?? '',
style:
TextStyle(fontSize: 12, color: HexColor.fromHex(model?.titleColor)),
style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.titleColor)),
), ),
), ),
), ),


/// 二级标题 /// 二级标题
Visibility( Visibility(
visible: !EmptyUtil.isEmpty(model?.isShowSubTitle) &&
model.isShowSubTitle == '1',
visible: !EmptyUtil.isEmpty(model?.isShowSubTitle) && model.isShowSubTitle == '1',
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 5), padding: const EdgeInsets.only(top: 5),
child: Text( child: Text(
item?.subTitle ?? '', item?.subTitle ?? '',
style: TextStyle(
fontSize: 10, color: HexColor.fromHex(model?.subTitleColor)),
style: TextStyle(fontSize: 10, color: HexColor.fromHex(model?.subTitleColor)),
), ),
), ),
) )
@@ -469,8 +449,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>


/// 进度条 /// 进度条
SwiperPlugin _getSwiperPaginationContorl(CustomQuickEntryModel model, int pageCount) { SwiperPlugin _getSwiperPaginationContorl(CustomQuickEntryModel model, int pageCount) {
if (EmptyUtil.isEmpty(model?.pagination) ||
model.pagination == 'type_null' /*model.pagination_open == '0'*/) {
if (EmptyUtil.isEmpty(model?.pagination) || model.pagination == 'type_null' /*model.pagination_open == '0'*/) {
return null; return null;
} }


@@ -487,11 +466,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
SwiperPagination _swiperPaginationDot(CustomQuickEntryModel model) { SwiperPagination _swiperPaginationDot(CustomQuickEntryModel model) {
return SwiperPagination( return SwiperPagination(
margin: const EdgeInsets.only(), margin: const EdgeInsets.only(),
builder: DotSwiperPaginationBuilder(
color: HexColor.fromHex(model?.paginationUnselectColor),
activeColor: HexColor.fromHex(model?.paginationSelectColor),
size: 8,
activeSize: 8));
builder: DotSwiperPaginationBuilder(color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 8, activeSize: 8));
} }


// 自定义进度条 条形 // 自定义进度条 条形
@@ -501,8 +476,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
list.add(i); list.add(i);
} }


return SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
return Align( return Align(
alignment: Alignment(0.0, 1), alignment: Alignment(0.0, 1),
child: Row( child: Row(
@@ -511,12 +485,10 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
children: list.map((index) { children: list.map((index) {
var borderRadius; var borderRadius;
if (index == 0) { if (index == 0) {
borderRadius = BorderRadius.only(
topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
borderRadius = BorderRadius.only(topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
} }
if (index == list.length - 1) { if (index == list.length - 1) {
borderRadius = BorderRadius.only(
topRight: Radius.circular(2), bottomRight: Radius.circular(2));
borderRadius = BorderRadius.only(topRight: Radius.circular(2), bottomRight: Radius.circular(2));
} }


if (index == config.activeIndex) { if (index == config.activeIndex) {
@@ -526,11 +498,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
return Container( return Container(
height: 4, height: 4,
width: 25, width: 25,
decoration: BoxDecoration(
borderRadius: borderRadius,
color: index == config.activeIndex
? HexColor.fromHex('#FF4242')
: HexColor.fromHex('#FFFFFF')),
decoration: BoxDecoration(borderRadius: borderRadius, color: index == config.activeIndex ? HexColor.fromHex('#FF4242') : HexColor.fromHex('#FFFFFF')),
); );
}).toList(), }).toList(),
), ),
@@ -569,12 +537,9 @@ class CustomQuickCateEntry extends StatefulWidget {
_CustomQuickCateEntryState createState() => _CustomQuickCateEntryState(); _CustomQuickCateEntryState createState() => _CustomQuickCateEntryState();
} }


class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
TabController tabController; TabController tabController;




bool isOnTap = false; bool isOnTap = false;


Timer onTapTimer; Timer onTapTimer;
@@ -585,15 +550,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>


@override @override
void initState() { void initState() {

if (widget?.model != null) { if (widget?.model != null) {
tabController =
TabController(length: widget?.model?.typeList?.length ?? 0, vsync: this);
tabController = TabController(length: widget?.model?.typeList?.length ?? 0, vsync: this);
tabController.addListener(() {}); tabController.addListener(() {});
} }
_controller = SwiperController(); _controller = SwiperController();



super.initState(); super.initState();
} }


@@ -660,7 +622,10 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
print("行数" + totalRowSize.toString()); print("行数" + totalRowSize.toString());


// 图标的高度 // 图标的高度
double iconHeight = 40;
double iconHeight = 40.0;
if (model?.isShowCornerIcon == '1') {
iconHeight = 43.5;
}
// 标题的高度 // 标题的高度
double titleHeight = 21.0; double titleHeight = 21.0;


@@ -680,16 +645,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
// 进度条的边距 // 进度条的边距
double barMargin = 10.0; double barMargin = 10.0;
// 总页数 // 总页数
int totalPage = totalDataSize % (totalRowSize * columSize) == 0
? totalDataSize ~/ (totalRowSize * columSize)
: (totalDataSize ~/ (totalRowSize * columSize)) + 1;
int totalPage = totalDataSize % (totalRowSize * columSize) == 0 ? totalDataSize ~/ (totalRowSize * columSize) : (totalDataSize ~/ (totalRowSize * columSize)) + 1;


Logger.log('totalPage = ' + totalPage?.toString()); Logger.log('totalPage = ' + totalPage?.toString());
// 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度 // 总体高度 = 行数 * (子元素高度 + 边距高度) + 进度条的高度
double totalHeight = totalRowSize * (itemHeight + barMargin); double totalHeight = totalRowSize * (itemHeight + barMargin);
if (totalPage > 1 &&
!EmptyUtil.isEmpty(model?.pagination) &&
model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
if (totalPage > 1 && !EmptyUtil.isEmpty(model?.pagination) && model.pagination != 'type_null' /*model.pagination_open == '0'*/) {
totalHeight = totalRowSize * (itemHeight + barMargin) + 6; totalHeight = totalRowSize * (itemHeight + barMargin) + 6;
} }


@@ -709,11 +670,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
totalHeight = totalHeight + moduleTitleHeight; totalHeight = totalHeight + moduleTitleHeight;
} }


double marginLeftRight = model?.isLeftRightMargin == "1"
? double.tryParse(model?.leftRightMargin ?? "0")
: 0;
double marginTop =
model?.isTopMargin == "1" ? double.tryParse(model?.topMargin ?? "0") : 0;
double marginLeftRight = model?.isLeftRightMargin == "1" ? double.tryParse(model?.leftRightMargin ?? "0") : 0;
double marginTop = model?.isTopMargin == "1" ? double.tryParse(model?.topMargin ?? "0") : 0;


int currentTypeIndex = 0; int currentTypeIndex = 0;


@@ -725,9 +683,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
} }


if (item.listStyle.length > totalRowSize) { if (item.listStyle.length > totalRowSize) {
for (int index = 0;
index < (item.listStyle.length / (columSize * totalRowSize)).ceil();
index++) {
for (int index = 0; index < (item.listStyle.length / (columSize * totalRowSize)).ceil(); index++) {
var list = List<ListStyle>(); var list = List<ListStyle>();
var startIndex = index * columSize * totalRowSize; var startIndex = index * columSize * totalRowSize;
for (var i = 0; i < columSize * totalRowSize; i++) { for (var i = 0; i < columSize * totalRowSize; i++) {
@@ -746,18 +702,15 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
} }


return Container( return Container(
margin:
EdgeInsets.only(top: marginTop, left: marginLeftRight, right: marginLeftRight),
margin: EdgeInsets.only(top: marginTop, left: marginLeftRight, right: marginLeftRight),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex(model?.bgColor ?? ''), color: HexColor.fromHex(model?.bgColor ?? ''),
//color: Colors.green, //color: Colors.green,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)),
topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)),
bottomLeft:
Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight:
Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)),
bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)),
)), )),
child: Container( child: Container(
height: totalHeight + (totalRowSize * 5) + 5 + 5, height: totalHeight + (totalRowSize * 5) + 5 + 5,
@@ -795,8 +748,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
controller: tabController, controller: tabController,
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.transparent, indicatorColor: Colors.transparent,
indicator:
BubbleTabIndicator(indicatorColor: HexColor.fromHex("#FF4242")),
indicator: BubbleTabIndicator(indicatorColor: HexColor.fromHex("#FF4242")),
), ),
) )
: Container(), : Container(),
@@ -841,9 +793,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>


_buildTab(CustomQuickEntryModel model, int columSize, double marginLeft) { _buildTab(CustomQuickEntryModel model, int columSize, double marginLeft) {
List<Widget> listWidget = List(); List<Widget> listWidget = List();
var maxWidth =
((MediaQuery.of(context).size.width - marginLeft * 2) - (32 * columSize)) /
columSize;
var maxWidth = ((MediaQuery.of(context).size.width - marginLeft * 2) - (32 * columSize)) / columSize;
print("测试" + columSize.toString()); print("测试" + columSize.toString());
for (var item in model?.typeList) { for (var item in model?.typeList) {
listWidget.add(Tab( listWidget.add(Tab(
@@ -858,15 +808,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>


/// 获取有分类页 /// 获取有分类页
_getCategoryPageWidget( _getCategoryPageWidget(
{double titleHeight,
double iconHeight,
int totalPage,
int currentPage,
int columSize,
int totalRowSize,
int totalDataSize,
CustomQuickEntryModel model,
double itemHeight}) {
{double titleHeight, double iconHeight, int totalPage, int currentPage, int columSize, int totalRowSize, int totalDataSize, CustomQuickEntryModel model, double itemHeight}) {
List rowList = []; List rowList = [];
for (int i = 0; i < totalRowSize; i++) { for (int i = 0; i < totalRowSize; i++) {
rowList.add(i); rowList.add(i);
@@ -970,16 +912,28 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => _itemIconClick(item), onTap: () => _itemIconClick(item),
child: Container( child: Container(
padding: EdgeInsets.only(top: model?.isShowCornerIcon == '1' ? 3 : 0),
height: itemHeight, height: itemHeight,
width: 60, width: 60,
// color: Colors.red, // color: Colors.red,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
/// 图标
MyNetWorkImage(
item.img,
width: 40,

Stack(
children: [
/// 图标
Center(
child: MyNetWorkImage(
item.img,
width: 40,
),
),
/// 小角标
Visibility(
visible: model?.isShowCornerIcon == '1',
child: Align(alignment: Alignment.topRight, child: Transform.translate( offset: Offset(7, -3) ,child: MyNetWorkImage(item?.rightIcon, width: 30))))
],
), ),


/// 一级标题 /// 一级标题
@@ -989,22 +943,19 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
padding: const EdgeInsets.only(top: 2), padding: const EdgeInsets.only(top: 2),
child: Text( child: Text(
item?.title ?? '', item?.title ?? '',
style:
TextStyle(fontSize: 12, color: HexColor.fromHex(model?.titleColor)),
style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.titleColor)),
), ),
), ),
), ),


/// 二级标题 /// 二级标题
Visibility( Visibility(
visible: !EmptyUtil.isEmpty(model?.isShowSubTitle) &&
model.isShowSubTitle == '1',
visible: !EmptyUtil.isEmpty(model?.isShowSubTitle) && model.isShowSubTitle == '1',
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 0), padding: const EdgeInsets.only(top: 0),
child: Text( child: Text(
item?.subTitle ?? '', item?.subTitle ?? '',
style: TextStyle(
fontSize: 10, color: HexColor.fromHex(model?.subTitleColor)),
style: TextStyle(fontSize: 10, color: HexColor.fromHex(model?.subTitleColor)),
), ),
), ),
) )
@@ -1023,8 +974,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>


/// 进度条 /// 进度条
SwiperPlugin _getSwiperPaginationContorl(CustomQuickEntryModel model, int pageCount) { SwiperPlugin _getSwiperPaginationContorl(CustomQuickEntryModel model, int pageCount) {
if (EmptyUtil.isEmpty(model?.pagination) ||
model.pagination == 'type_null' /*model.pagination_open == '0'*/) {
if (EmptyUtil.isEmpty(model?.pagination) || model.pagination == 'type_null' /*model.pagination_open == '0'*/) {
return null; return null;
} }


@@ -1042,11 +992,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
return SwiperPagination( return SwiperPagination(
margin: const EdgeInsets.only(), margin: const EdgeInsets.only(),
builder: DotSwiperPaginationBuilder( builder: DotSwiperPaginationBuilder(
space: 2,
color: HexColor.fromHex(model?.paginationUnselectColor),
activeColor: HexColor.fromHex(model?.paginationSelectColor),
size: 6,
activeSize: 7));
space: 2, color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 6, activeSize: 7));
} }


// 自定义进度条 条形 // 自定义进度条 条形
@@ -1055,8 +1001,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
for (int i = 0; i < pageCount; i++) { for (int i = 0; i < pageCount; i++) {
list.add(i); list.add(i);
} }
return SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
return Align( return Align(
alignment: Alignment(0.0, 1), alignment: Alignment(0.0, 1),
child: Row( child: Row(
@@ -1065,12 +1010,10 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
children: list.map((index) { children: list.map((index) {
var borderRadius; var borderRadius;
if (index == 0) { if (index == 0) {
borderRadius = BorderRadius.only(
topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
borderRadius = BorderRadius.only(topLeft: Radius.circular(2), bottomLeft: Radius.circular(2));
} }
if (index == list.length - 1) { if (index == list.length - 1) {
borderRadius = BorderRadius.only(
topRight: Radius.circular(2), bottomRight: Radius.circular(2));
borderRadius = BorderRadius.only(topRight: Radius.circular(2), bottomRight: Radius.circular(2));
} }


if (index == config.activeIndex) { if (index == config.activeIndex) {
@@ -1079,13 +1022,9 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>


return Container( return Container(
height: 4, height: 4,
width: 8,

width: 8,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius,
color: index == config.activeIndex
? HexColor.fromHex(model.paginationSelectColor)
: HexColor.fromHex(model.paginationUnselectColor)),
borderRadius: borderRadius, color: index == config.activeIndex ? HexColor.fromHex(model.paginationSelectColor) : HexColor.fromHex(model.paginationUnselectColor)),
); );
}).toList(), }).toList(),
), ),
@@ -1094,7 +1033,6 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry>
} }


@override @override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }




+ 5
- 0
lib/widgets/home/home_goods/models/home_goods_model.dart View File

@@ -12,6 +12,7 @@ class HomeGoodsModel extends Equatable {
String marketPrice; String marketPrice;
String currentPrice; String currentPrice;
String inorderCount; String inorderCount;
String pvd;
Map<String, dynamic> detailData; Map<String, dynamic> detailData;


HomeGoodsModel({ HomeGoodsModel({
@@ -27,6 +28,7 @@ class HomeGoodsModel extends Equatable {
this.currentPrice, this.currentPrice,
this.inorderCount, this.inorderCount,
this.detailData, this.detailData,
this.pvd,
}); });


HomeGoodsModel.fromJson(Map<String, dynamic> json) { HomeGoodsModel.fromJson(Map<String, dynamic> json) {
@@ -42,6 +44,7 @@ class HomeGoodsModel extends Equatable {
currentPrice = json['current_price']; currentPrice = json['current_price'];
inorderCount = json['inorder_count']; inorderCount = json['inorder_count'];
detailData = json['detail_data']; detailData = json['detail_data'];
pvd = json['pvd'];
} }


void fromJson(Map<String, dynamic> json) { void fromJson(Map<String, dynamic> json) {
@@ -57,6 +60,7 @@ class HomeGoodsModel extends Equatable {
currentPrice = json['current_price']; currentPrice = json['current_price'];
inorderCount = json['inorder_count']; inorderCount = json['inorder_count'];
detailData = json['detail_data']; detailData = json['detail_data'];
pvd = json['pvd'];
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -73,6 +77,7 @@ class HomeGoodsModel extends Equatable {
data['current_price'] = this.currentPrice; data['current_price'] = this.currentPrice;
data['inorder_count'] = this.inorderCount; data['inorder_count'] = this.inorderCount;
data['detail_data'] = this.detailData; data['detail_data'] = this.detailData;
data['pvd'] = this.pvd;
return data; return data;
} }




Loading…
Cancel
Save