newsfeed_state.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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? useTag = 0;
  6. int? curPage;
  7. int? pageSize;
  8. int? filterCount;
  9. int? activeIndex = 0;
  10. List tabsList = [];
  11. List? list = [];
  12. NewsfeedState copyWith({
  13. int? useTag,
  14. int? curPage,
  15. int? pageSize,
  16. int? filterCount,
  17. int? activeIndex,
  18. List? tabsList,
  19. List? list,
  20. }) {
  21. return NewsfeedState(
  22. useTag: useTag ?? this.useTag,
  23. curPage: curPage ?? this.curPage,
  24. pageSize: pageSize ?? this.pageSize,
  25. filterCount: filterCount ?? this.filterCount,
  26. activeIndex: activeIndex ?? this.activeIndex,
  27. tabsList: tabsList ?? this.tabsList,
  28. list: list ?? this.list,
  29. );
  30. }
  31. Map<String, dynamic> toMap() {
  32. return {
  33. 'useTag': this.useTag,
  34. 'curPage': this.curPage,
  35. 'pageSize': this.pageSize,
  36. 'filterCount': this.filterCount,
  37. 'activeIndex': this.activeIndex,
  38. 'tabsList': this.tabsList,
  39. 'list': this.list,
  40. };
  41. }
  42. factory NewsfeedState.fromMap(Map<String, dynamic> map) {
  43. return NewsfeedState(
  44. useTag: map['useTag'] as int,
  45. curPage: map['curPage'] as int,
  46. pageSize: map['pageSize'] as int,
  47. filterCount: map['filterCount'] as int,
  48. activeIndex: map['activeIndex'] as int,
  49. tabsList: map['tabsList'] as List,
  50. list: map['list'] as List,
  51. );
  52. }
  53. NewsfeedState({
  54. this.useTag,
  55. this.curPage,
  56. this.pageSize,
  57. this.filterCount,
  58. this.activeIndex,
  59. required this.tabsList,
  60. this.list,
  61. });
  62. }