-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add content models to DSInteractiveListMessageBubble
- Loading branch information
Marcelo Amaro
committed
Nov 20, 2023
1 parent
dad66c3
commit 11e2d13
Showing
16 changed files
with
273 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lib/src/models/interactive_list_message/ds_interactive_list_message.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'ds_interactive_list_message_action.model.dart'; | ||
import 'ds_interactive_list_message_body.model.dart'; | ||
import 'ds_interactive_list_message_footer.model.dart'; | ||
|
||
class DSInteractiveListMessage { | ||
final DSInteractiveListMessageBody? body; | ||
final DSInteractiveListMessageAction? action; | ||
final DSInteractiveListMessageFooter? footer; | ||
|
||
DSInteractiveListMessage({ | ||
this.body, | ||
this.action, | ||
this.footer, | ||
}); | ||
|
||
DSInteractiveListMessage.fromJson(Map<String, dynamic> json) | ||
: body = json['body'] != null | ||
? DSInteractiveListMessageBody.fromJson(json['body']) | ||
: null, | ||
action = json['action'] != null | ||
? DSInteractiveListMessageAction.fromJson(json['action']) | ||
: null, | ||
footer = json['footer'] != null | ||
? DSInteractiveListMessageFooter.fromJson(json['footer']) | ||
: null; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'body': body?.toJson(), | ||
'action': action?.toJson(), | ||
'footer': footer?.toJson(), | ||
}; | ||
} |
30 changes: 30 additions & 0 deletions
30
lib/src/models/interactive_list_message/ds_interactive_list_message_action.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'ds_interactive_list_message_section.model.dart'; | ||
|
||
class DSInteractiveListMessageAction { | ||
final String? button; | ||
final List<DSInteractiveListMessageSection>? sections; | ||
|
||
DSInteractiveListMessageAction({ | ||
this.button, | ||
this.sections, | ||
}); | ||
|
||
DSInteractiveListMessageAction.fromJson(Map<String, dynamic> json) | ||
: button = json['button'], | ||
sections = json['sections'] != null | ||
? List.from(json['sections']) | ||
.map( | ||
(e) => DSInteractiveListMessageSection.fromJson(e), | ||
) | ||
.toList() | ||
: null; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'button': button, | ||
'sections': sections | ||
?.map( | ||
(e) => e.toJson(), | ||
) | ||
.toList(), | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_list_message/ds_interactive_list_message_body.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveListMessageBody { | ||
final String? text; | ||
|
||
DSInteractiveListMessageBody({ | ||
this.text, | ||
}); | ||
|
||
DSInteractiveListMessageBody.fromJson(Map<String, dynamic> json) | ||
: text = json['text']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'text': text, | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_list_message/ds_interactive_list_message_footer.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveListMessageFooter { | ||
final String? text; | ||
|
||
DSInteractiveListMessageFooter({ | ||
this.text, | ||
}); | ||
|
||
DSInteractiveListMessageFooter.fromJson(Map<String, dynamic> json) | ||
: text = json['text']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'text': text, | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_list_message/ds_interactive_list_message_row.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveListMessageRow { | ||
final String? title; | ||
|
||
DSInteractiveListMessageRow({ | ||
this.title, | ||
}); | ||
|
||
DSInteractiveListMessageRow.fromJson(Map<String, dynamic> json) | ||
: title = json['title']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'title': title, | ||
}; | ||
} |
24 changes: 24 additions & 0 deletions
24
lib/src/models/interactive_list_message/ds_interactive_list_message_section.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'ds_interactive_list_message_row.model.dart'; | ||
|
||
class DSInteractiveListMessageSection { | ||
final List<DSInteractiveListMessageRow>? rows; | ||
|
||
DSInteractiveListMessageSection({ | ||
this.rows, | ||
}); | ||
|
||
DSInteractiveListMessageSection.fromJson(Map<String, dynamic> json) | ||
: rows = List.from(json['rows']) | ||
.map( | ||
(e) => DSInteractiveListMessageRow.fromJson(e), | ||
) | ||
.toList(); | ||
|
||
Map<String, dynamic> toJson() => { | ||
'rows': rows | ||
?.map( | ||
(e) => e.toJson(), | ||
) | ||
.toList(), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.