community_state.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:cpt_community/modules/community/community_page.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import '../garage/garage_page.dart';
  4. class CommunityVmState {
  5. List<Map<String, dynamic>>? topSectionsData;
  6. List? tabsList = ["News", "Following", "For You"];
  7. int currentTabIndex = 0;
  8. dynamic? tabsRouter;
  9. dynamic? pageController;
  10. CommunityVmState({
  11. List<Map<String, dynamic>>? topSectionsData,
  12. required this.currentTabIndex,
  13. this.tabsList,
  14. this.tabsRouter,
  15. this.pageController,
  16. }) : topSectionsData = topSectionsData?? [
  17. {
  18. "title": "News Feed",
  19. "icon": Assets.communityNesFeed,
  20. "pageStartInstanceFn": CommunityPage.startInstance,
  21. "page": const CommunityPage(),
  22. },
  23. {
  24. "title": "Garage Sale",
  25. "icon": Assets.communityGarageSale,
  26. "pageStartInstanceFn": GaragePage.startInstance,
  27. "page": const GaragePage(),
  28. },
  29. ];
  30. CommunityVmState copyWith({
  31. List<Map<String, dynamic>>? topSectionsData,
  32. List? tabsList,
  33. int? currentTabIndex,
  34. dynamic? tabsRouter,
  35. dynamic? pageController,
  36. }) {
  37. return CommunityVmState(
  38. topSectionsData: topSectionsData ?? this.topSectionsData,
  39. tabsList: tabsList ?? this.tabsList,
  40. currentTabIndex: currentTabIndex ?? this.currentTabIndex,
  41. tabsRouter: tabsRouter ?? this.tabsRouter,
  42. pageController: pageController ?? this.pageController,
  43. );
  44. }
  45. }