提交 0076ac32 authored 作者: yueweilu's avatar yueweilu

1、分类 标签为空展示逻辑

上级 55e4b047
......@@ -121,12 +121,18 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
for(FilterModel model in filterCategories){
model.selected = false;
}
filterCategories.first.selected = true;
if(filterCategories.isNotEmpty){
selectedCategory = filterCategories.first;
selectedCategory.selected = true;
}
for(FilterModel model in filterLabels){
model.selected = false;
}
filterLabels.first.selected = true;
if(filterLabels.isNotEmpty){
selectedLabel = filterLabels.first;
selectedLabel.selected = true;
}
for(FilterModel model in filterFree){
model.selected = false;
......@@ -135,8 +141,9 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
for(FilterModel model in filterDown){
model.selected = false;
}
update();
// onRefresh();
update();
}
/// 确定
......@@ -206,8 +213,10 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
filterCategories = categories.map((model) {
return FilterModel(id: model.categoryId.toString(), name: model.name??'',selected: model.selected);
}).toList();
if(filterCategories.isNotEmpty){
selectedCategory = filterCategories.first;
selectedCategory.selected = true;
}
update();
}
......@@ -218,8 +227,10 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
filterLabels = labels.map((model) {
return FilterModel(id: model.labelId.toString(), name: model.name??'',selected: model.selected);
}).toList();
if (filterLabels.isNotEmpty){
selectedLabel = filterLabels.first;
selectedLabel.selected = true;
}
update(['label']);
......
......@@ -41,8 +41,8 @@ class _LibraryPageState extends State<LibraryPage> {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child: _buildCategory()),
GestureDetector(
controller.filterCategories.isEmpty?const SizedBox():Expanded(child: _buildCategory()),
controller.filterCategories.isEmpty?const SizedBox():GestureDetector(
onTap: (){
controller.setShow(controller.show);
},
......@@ -115,7 +115,8 @@ class _LibraryPageState extends State<LibraryPage> {
controller.sureFilter();
},
resetTap: (){
// controller.setShow(controller.show);
controller.resetFilter();
},),
),
],
......
......@@ -41,8 +41,8 @@ class _FilterPageState extends State<FilterPage> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildWrapWidget('分类', widget.controller.filterCategories),
_buildWrapWidget('标签', widget.controller.filterLabels),
widget.controller.filterCategories.isEmpty?const SizedBox():_buildWrapWidget('分类', widget.controller.filterCategories),
widget.controller.filterLabels.isEmpty?const SizedBox():_buildWrapWidget('标签', widget.controller.filterLabels),
_buildWrapWidget('是否收费', widget.controller.filterFree),
_buildWrapWidget('排序', widget.controller.filterDown),
],
......@@ -60,9 +60,7 @@ class _FilterPageState extends State<FilterPage> {
children: [
Expanded(
child: GestureDetector(
onTap: (){
widget.controller.resetFilter();
},
onTap: widget.resetTap,
child: Container(
alignment: Alignment.center,
height: 35.w,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论