garage_state.dart 1.8 KB

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