@@ -22,7 +22,8 @@ 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),
);
);
@@ -38,7 +39,8 @@ 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}");
@@ -136,12 +138,16 @@ 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;
}
}
@@ -161,21 +167,28 @@ 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,
@@ -188,14 +201,20 @@ 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,
@@ -218,7 +237,9 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
),
),
);
);
},
},
pagination: totalPage <= 1 ? null : _getSwiperPaginationContorl(model, totalPage),
pagination: totalPage <= 1
? null
: _getSwiperPaginationContorl(model, totalPage),
),
),
),
),
)
)
@@ -289,7 +310,15 @@ 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);
@@ -375,7 +404,8 @@ 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');
@@ -410,19 +440,22 @@ 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: 10, color: HexColor.fromHex(model?.titleColor)),
style:
TextStyle(fontSize: 10, 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)),
),
),
),
),
)
)
@@ -434,7 +467,8 @@ 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;
}
}
@@ -452,7 +486,10 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
return SwiperPagination(
return SwiperPagination(
margin: const EdgeInsets.only(),
margin: const EdgeInsets.only(),
builder: DotSwiperPaginationBuilder(
builder: DotSwiperPaginationBuilder(
color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 8, activeSize: 8));
color: HexColor.fromHex(model?.paginationUnselectColor),
activeColor: HexColor.fromHex(model?.paginationSelectColor),
size: 8,
activeSize: 8));
}
}
// 自定义进度条 条形
// 自定义进度条 条形
@@ -462,7 +499,8 @@ 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(
@@ -471,10 +509,12 @@ 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) {
@@ -484,7 +524,11 @@ 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(),
),
),
@@ -600,7 +644,8 @@ 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;
PrimaryPageController primaryPageController;
PrimaryPageController primaryPageController;
@@ -617,7 +662,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
void initState() {
void initState() {
// primaryPageController = PrimaryPageController(keepPage: true);
// primaryPageController = PrimaryPageController(keepPage: true);
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();
@@ -697,7 +743,6 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
}
}
}
}
//计算实际显示行数
//计算实际显示行数
print("行数" + totalRowSize.toString());
print("行数" + totalRowSize.toString());
@@ -722,12 +767,16 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
// 进度条的边距
// 进度条的边距
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;
}
}
@@ -747,8 +796,11 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
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;
@@ -760,7 +812,9 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
}
}
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++) {
@@ -779,18 +833,21 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
}
}
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,
margin: EdgeInsets.only(bottom: model?.pagination == "type_null" ? 0 : 8),
margin: EdgeInsets.only(bottom: model?.pagination == "type_null" ? 0 : 8),
child: Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -820,12 +877,13 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
labelColor: HexColor.fromHex("#FFFFFF"),
labelColor: HexColor.fromHex("#FFFFFF"),
unselectedLabelColor: HexColor.fromHex("#FF333333"),
unselectedLabelColor: HexColor.fromHex("#FF333333"),
labelStyle: TextStyle(fontSize: 14),
labelStyle: TextStyle(fontSize: 14),
tabs: _buildTab(model,columSize,marginLeftRight),
labelPadding: EdgeInsets.only(left: 16,right: 16),
tabs: _buildTab(model, columSize, marginLeftRight),
labelPadding: EdgeInsets.only(left: 16, right: 16),
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(),
@@ -860,7 +918,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
),
),
);
);
},
},
pagination: _getSwiperPaginationContorl(model, model?.ty peList?.length ?? 0),
pagination: _getSwiperPaginationContorl(model, pag eList?.length ?? 0),
)),
)),
],
],
),
),
@@ -868,15 +926,17 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
);
);
}
}
_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;
print("测试"+columSize.toString());
var maxWidth =
((MediaQuery.of(context).size.width - marginLeft * 2) - (32 * columSize)) /
columSize;
print("测试" + columSize.toString());
for (var item in model?.typeList) {
for (var item in model?.typeList) {
listWidget.add(Tab(
listWidget.add(Tab(
child: Container(
child: Container(
width: maxWidth,
width: maxWidth,
child: Center(child: Text(item.name??"")),
child: Center(child: Text(item.name ?? "")),
),
),
));
));
}
}
@@ -885,7 +945,15 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
/// 获取有分类页
/// 获取有分类页
_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);
@@ -974,10 +1042,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
// 当前元素的下表 = 当前的列数 + 当前的行数 * 列数 + 当前的页数 * 当前的行数 + 当前的列数
// 当前元素的下表 = 当前的列数 + 当前的行数 * 列数 + 当前的页数 * 当前的行数 + 当前的列数
int currentIndex = currentColum + currentRow * columSize;
int currentIndex = currentColum + currentRow * columSize;
print("当前页" + currentPage.toString() + "当前点" + currentIndex.toString());
print("当前页" + currentPage.toString() + "当前点" + currentIndex.toString());
// print('current Index sss = $currentIndex');
// print('current Index sss = $currentIndex');
if (currentIndex >= totalDataSize) {
if (currentIndex >= totalDataSize) {
return Container(
return Container(
height: itemHeight,
height: itemHeight,
@@ -992,34 +1058,40 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
onTap: () => _itemIconClick(item),
onTap: () => _itemIconClick(item),
child: Container(
child: Container(
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,),
MyNetWorkImage(
item.img,
width: 40,
),
/// 一级标题
/// 一级标题
Visibility(
Visibility(
visible: !EmptyUtil.isEmpty(model?.isShowTitle) && model.isShowTitle == '1',
visible: !EmptyUtil.isEmpty(model?.isShowTitle) && model.isShowTitle == '1',
child: Padding(
child: Padding(
padding: const EdgeInsets.only(top: 5 ),
padding: const EdgeInsets.only(top: 2 ),
child: Text(
child: Text(
item?.title ?? '',
item?.title ?? '',
style: TextStyle(fontSize: 10, 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: 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)),
),
),
),
),
)
)
@@ -1038,7 +1110,8 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
/// 进度条
/// 进度条
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;
}
}
@@ -1047,7 +1120,7 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
return _swiperPaginationDot(model);
return _swiperPaginationDot(model);
} else {
} else {
// 自定义进度条
// 自定义进度条
return _swiperCustomPagination(pageCount);
return _swiperCustomPagination(pageCount, model );
}
}
}
}
@@ -1056,18 +1129,21 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
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));
}
}
// 自定义进度条 条形
// 自定义进度条 条形
SwiperPlugin _swiperCustomPagination(int pageCount) {
SwiperPlugin _swiperCustomPagination(int pageCount, CustomQuickEntryModel model ) {
List list = [];
List list = [];
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(
@@ -1076,10 +1152,12 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
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) {
@@ -1088,8 +1166,13 @@ class _CustomQuickCateEntryState extends State<CustomQuickCateEntry> with Ticker
return Container(
return Container(
height: 4,
height: 4,
width: 25,
decoration: BoxDecoration(borderRadius: borderRadius, color: index == config.activeIndex ? HexColor.fromHex('#FF4242') : HexColor.fromHex('#FFFFFF')),
width: 8,
decoration: BoxDecoration(
borderRadius: borderRadius,
color: index == config.activeIndex
? HexColor.fromHex(model.paginationSelectColor)
: HexColor.fromHex(model.paginationUnselectColor)),
);
);
}).toList(),
}).toList(),
),
),