Browse Source

property - news 列表增加 收藏筛选

glglove 2 weeks ago
parent
commit
0001838d13

+ 1 - 1
packages/cpt_property/lib/modules/news/vm/property_news_vm.dart

@@ -27,7 +27,7 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   int _count = 0; // 总条数
 
   Map<String, dynamic> _newsQueryMap = {
-    "isCollection": false,
+    "isCollection": 0,  //  0  未收藏,1 已收藏
   };
 
   // Refresh 控制器

+ 3 - 3
packages/cpt_property/lib/modules/property/page/property_page.dart

@@ -97,7 +97,7 @@ class PropertyPage extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(propertyVmProvider.notifier);
     final state = ref.watch(propertyVmProvider);
-    final isCollection = useState<bool>(false);
+    final isCollection = useState<int>(0);
 
     useEffect((){
       WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
@@ -120,11 +120,11 @@ class PropertyPage extends HookConsumerWidget {
           backgroundColor: context.appColors.backgroundWhite,
           actions: [
              state.currentPageViewIdx == 1? MyAssetImage(
-              isCollection.value? Assets.propertyCollectionActive: Assets.propertyCollection,
+              isCollection.value ==1? Assets.propertyCollectionActive: Assets.propertyCollection,
               width: 22.5,
               height: 21,
             ).onTap((){
-               isCollection.value = !isCollection.value;
+               isCollection.value = isCollection.value ==1?0:1;
               _vm.handlerCollectionFilter(context,isCollection.value);
             }):Container(),
             const SizedBox(width: 20),

+ 2 - 2
packages/cpt_property/lib/modules/property/vm/property_vm.dart

@@ -20,7 +20,7 @@ class PropertyVm extends _$PropertyVm {
   get topSectionsData => state.topSectionsData;
 
   Map<String, dynamic> _newsQueryMap = {
-    "isCollection": false,
+    "isCollection": 0, // 0 全部 1 已收藏
   };
 
   PropertyVmState initState() {
@@ -46,7 +46,7 @@ class PropertyVm extends _$PropertyVm {
   }
 
   // 点击了导航的 搜索 进行筛选
-  handlerCollectionFilter(BuildContext? context, bool isCollection ){
+  handlerCollectionFilter(BuildContext? context, int isCollection ){
     _newsQueryMap['isCollection'] = isCollection;
 
     // 重新加载数据