ext_discovery.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart';
  2. extension ExtDiscovery on Discovery {
  3. bool get isHorizontalScrollCard =>
  4. this.type == 'horizontalScrollCard' &&
  5. this.data != null &&
  6. this.data.discoveryList.isNotEmpty &&
  7. this.data.discoveryList[0] != null &&
  8. this.data.discoveryList[0].data.dataType == 'Banner';
  9. bool get isSpecialSquareHeader =>
  10. type == 'specialSquareCardCollection' &&
  11. this.data != null &&
  12. this.data.header != null &&
  13. this.data.header.title != null;
  14. bool get isSpecialSquareCard =>
  15. type == 'specialSquareCardCollection' &&
  16. this.data != null &&
  17. this.data.discoveryList != null &&
  18. this.data.discoveryList.isNotEmpty &&
  19. this.data.discoveryList[0].type == 'squareCardOfCategory' &&
  20. this.data.discoveryList[0].data.dataType == 'SquareCard';
  21. bool get isColumnCardListHeader =>
  22. type == 'columnCardList' &&
  23. this.data != null &&
  24. this.data.header != null &&
  25. this.data.header.title != null;
  26. bool get isColumnCardList =>
  27. type == 'columnCardList' &&
  28. this.data != null &&
  29. this.data.discoveryList != null &&
  30. this.data.discoveryList.isNotEmpty &&
  31. this.data.discoveryList[0].type == 'squareCardOfColumn' &&
  32. this.data.discoveryList[0].data.dataType == 'SquareCard';
  33. bool get isHeaderCard =>
  34. type == 'textCard' && data != null && data.text.isNotEmpty;
  35. bool get isBriefCard =>
  36. type == 'briefCard' && data != null;
  37. }