carousel.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import 'package:sport/services/Converter.dart';
  2. /// id : 4
  3. /// type : "image"
  4. /// url : "http://4.jpg"
  5. /// position : 4
  6. /// cover : ""
  7. /// game_id : 3
  8. class Carousel {
  9. late int id;
  10. late String type;
  11. late String url;
  12. late int position;
  13. late String? cover;
  14. late int gameId;
  15. late String? outerUrl;
  16. late String? outerDesc;
  17. Map<String, dynamic> toMap() {
  18. return {
  19. 'id': this.id,
  20. 'type': this.type,
  21. 'url': this.url,
  22. 'position': this.position,
  23. 'cover': this.cover,
  24. 'game_id': this.gameId,
  25. 'outer_url': this.outerUrl,
  26. 'outer_desc': this.outerDesc,
  27. };
  28. }
  29. factory Carousel.fromMap(Map<String, dynamic> map) {
  30. return Carousel(
  31. id: map['id'] as int,
  32. type: map['type'] as String,
  33. url: map['url'] as String,
  34. position: map['position'] as int,
  35. cover: map['cover'] as String?,
  36. gameId: Converter.toInt(map['game_id']),
  37. outerUrl: map['outer_url'] as String?,
  38. outerDesc: map['outer_desc'] as String?,
  39. );
  40. }
  41. Carousel({
  42. required this.id,
  43. required this.type,
  44. required this.url,
  45. required this.position,
  46. required this.cover,
  47. required this.gameId,
  48. required this.outerUrl,
  49. required this.outerDesc,
  50. });
  51. }