home_state.dart 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:domain/entity/home_list_entity.dart';
  4. class HomeState {
  5. final List<Map<String, dynamic>> homeCategory;
  6. final List<Map<String, dynamic>> lastNews;
  7. HomeListEntity? homeIndex;
  8. HomeState({
  9. List<Map<String, dynamic>>? homeCategory,
  10. List<Map<String, dynamic>>? lastNews,
  11. this.homeIndex,
  12. }) : homeCategory = homeCategory ??
  13. [
  14. {
  15. 'category_name': S.current.facility,
  16. 'category_icon': Assets.mainHomeFacilityIcon,
  17. },
  18. {
  19. 'category_name': S.current.form,
  20. 'category_icon': Assets.mainHomeFormsIcon,
  21. },
  22. {
  23. 'category_name': S.current.notice_board,
  24. 'category_icon': Assets.mainHomeBoticeBoardIcon,
  25. },
  26. {
  27. 'category_name': S.current.property,
  28. 'category_icon': Assets.mainHomePropertyIcon,
  29. },
  30. {
  31. 'category_name': S.current.service,
  32. 'category_icon': Assets.mainHomeServiceIcon,
  33. },
  34. {
  35. 'category_name': S.current.community,
  36. 'category_icon': Assets.mainHomeCommunityIcon,
  37. }
  38. ],
  39. lastNews = lastNews ??
  40. [
  41. {
  42. 'category_name': S.current.property,
  43. 'category_icon': Assets.mainHomePropertyNews,
  44. 'icon_width': 38.5,
  45. 'icon_height': 39.5,
  46. 'margin_right': 13.0,
  47. },
  48. {
  49. 'category_name': S.current.internal,
  50. 'category_icon': Assets.mainHomeInternalNews,
  51. 'icon_width': 33.5,
  52. 'icon_height': 41.0,
  53. 'margin_right': 11.0,
  54. },
  55. {
  56. 'category_name': S.current.info,
  57. 'category_icon': Assets.mainHomeInfoNews,
  58. 'icon_width': 44.0,
  59. 'icon_height': 42.0,
  60. 'margin_right': 6.0,
  61. },
  62. {
  63. 'category_name': S.current.notice,
  64. 'category_icon': Assets.mainHomePublishNews,
  65. 'icon_width': 40.5,
  66. 'icon_height': 42.5,
  67. 'margin_right': 11.0,
  68. }
  69. ];
  70. HomeState copyWith({
  71. HomeListEntity? homeIndex,
  72. }) {
  73. return HomeState(
  74. homeIndex: homeIndex ?? this.homeIndex,
  75. homeCategory: homeCategory,
  76. lastNews: lastNews,
  77. );
  78. }
  79. }