import 'package:cpt_community/modules/community/community_page.dart'; import 'package:cs_resources/generated/assets.dart'; class CommunityVmState { List>? topSectionsData; List? newsFeedTabsList; List? garageSaleTabsList; List>? garageCategoryList = []; // garageCategoryList int currentCategoryIdx = 0; // 0: news feed, 1: garage sale int currentPageViewIdx = 0; int lastNewsfeedTabIdx = 0; // 上一次newsfeed 的 tabIdx int lastGarageTabIdx = 0; // 上一次garagesale 的 tabIdx dynamic? tabsRouter; dynamic? pageController; CommunityVmState({ List>? topSectionsData, required this.currentPageViewIdx, currentCategoryIdx, lastNewsfeedTabIdx, lastGarageTabIdx, newsFeedTabsList, garageSaleTabsList, List>? garageCategoryList, this.tabsRouter, this.pageController, }) : topSectionsData = topSectionsData?? [ { "title": "News Feed", "icon": Assets.communityNews, }, { "title": "Garage Sale", "icon": Assets.communityGarageSale, }, ], currentCategoryIdx = currentCategoryIdx?? 0, lastGarageTabIdx = lastGarageTabIdx?? 0, lastNewsfeedTabIdx = lastNewsfeedTabIdx?? 0, newsFeedTabsList = newsFeedTabsList?? [ "News", "Following", "For You", ], garageSaleTabsList = garageSaleTabsList?? [ "For Sale", "For Rent", ], garageCategoryList = garageCategoryList?? []; CommunityVmState copyWith({ List>? topSectionsData, List? newsFeedTabsList, List? garageSaleTabsList, int? currentCategoryIdx, int? currentPageViewIdx, int? lastNewsfeedTabIdx, int? lastGarageTabIdx, List>? garageCategoryList, dynamic? tabsRouter, dynamic? pageController, }) { return CommunityVmState( topSectionsData: topSectionsData ?? this.topSectionsData, newsFeedTabsList: newsFeedTabsList ?? this.newsFeedTabsList, garageSaleTabsList: garageSaleTabsList ?? this.garageSaleTabsList, currentCategoryIdx: currentCategoryIdx ?? this.currentCategoryIdx, currentPageViewIdx: currentPageViewIdx ?? this.currentPageViewIdx, lastNewsfeedTabIdx: lastNewsfeedTabIdx ?? this.lastNewsfeedTabIdx, lastGarageTabIdx: lastGarageTabIdx ?? this.lastGarageTabIdx, garageCategoryList: garageCategoryList ?? this.garageCategoryList, tabsRouter: tabsRouter ?? this.tabsRouter, pageController: pageController ?? this.pageController, ); } }