123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import 'package:cpt_community/modules/community/community_page.dart';
- import 'package:cs_resources/generated/assets.dart';
- class CommunityVmState {
- List<Map<String, dynamic>>? topSectionsData;
- List<String>? newsFeedTabsList;
- List<String>? garageSaleTabsList;
- List<Map<String, dynamic>>? 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<Map<String, dynamic>>? topSectionsData,
- required this.currentPageViewIdx,
- currentCategoryIdx,
- lastNewsfeedTabIdx,
- lastGarageTabIdx,
- newsFeedTabsList,
- garageSaleTabsList,
- List<Map<String, dynamic>>? 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<Map<String, dynamic>>? topSectionsData,
- List<String>? newsFeedTabsList,
- List<String>? garageSaleTabsList,
- int? currentCategoryIdx,
- int? currentPageViewIdx,
- int? lastNewsfeedTabIdx,
- int? lastGarageTabIdx,
- List<Map<String, dynamic>>? 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,
- );
- }
- }
|