newsfeed_state.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:shared/utils/color_utils.dart';
  4. class NewsfeedState {
  5. int? curPage;
  6. int? pageSize;
  7. int? filterCount;
  8. int? activeIndex = 0;
  9. List tabsList = [];
  10. List? list = [];
  11. NewsfeedState copyWith({
  12. int? curPage,
  13. int? pageSize,
  14. int? filterCount,
  15. int? activeIndex,
  16. List? tabsList,
  17. List? list,
  18. }) {
  19. return NewsfeedState(
  20. curPage: curPage ?? this.curPage,
  21. pageSize: pageSize ?? this.pageSize,
  22. filterCount: filterCount ?? this.filterCount,
  23. activeIndex: activeIndex ?? this.activeIndex,
  24. tabsList: tabsList ?? this.tabsList,
  25. list: list ?? this.list,
  26. );
  27. }
  28. Map<String, dynamic> toMap() {
  29. return {
  30. 'curPage': this.curPage,
  31. 'pageSize': this.pageSize,
  32. 'filterCount': this.filterCount,
  33. 'activeIndex': this.activeIndex,
  34. 'tabsList': this.tabsList,
  35. 'list': this.list,
  36. };
  37. }
  38. factory NewsfeedState.fromMap(Map<String, dynamic> map) {
  39. return NewsfeedState(
  40. curPage: map['curPage'] as int,
  41. pageSize: map['pageSize'] as int,
  42. filterCount: map['filterCount'] as int,
  43. activeIndex: map['activeIndex'] as int,
  44. tabsList: map['tabsList'] as List,
  45. list: map['list'] as List,
  46. );
  47. }
  48. NewsfeedState({
  49. this.curPage,
  50. this.pageSize,
  51. this.filterCount,
  52. this.activeIndex,
  53. required this.tabsList,
  54. this.list,
  55. });
  56. }