-
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.
Merge pull request #267 from takenet/develop
[Release] 0.1.4
- Loading branch information
Showing
8 changed files
with
139 additions
and
2 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
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_parameters.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 DSInteractiveMessageParameters { | ||
final String? displayText; | ||
|
||
DSInteractiveMessageParameters({ | ||
this.displayText, | ||
}); | ||
|
||
DSInteractiveMessageParameters.fromJson(Map<String, dynamic> json) | ||
: displayText = json['display_text']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'display_text': displayText, | ||
}; | ||
} |
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
95 changes: 95 additions & 0 deletions
95
lib/src/widgets/chat/ds_interactive_voice_call_message_bubble.widget.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,95 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../enums/ds_align.enum.dart'; | ||
import '../../enums/ds_border_radius.enum.dart'; | ||
import '../../models/ds_message_bubble_style.model.dart'; | ||
import '../../models/interactive_message/ds_interactive_message.model.dart'; | ||
import '../../themes/colors/ds_colors.theme.dart'; | ||
import '../../themes/icons/ds_icons.dart'; | ||
import '../texts/ds_body_text.widget.dart'; | ||
import '../utils/ds_divider.widget.dart'; | ||
import 'ds_message_bubble.widget.dart'; | ||
|
||
class DSInteractiveVoiceCallMessageBubble extends StatelessWidget { | ||
final DSInteractiveMessage content; | ||
final DSAlign align; | ||
final List<DSBorderRadius> borderRadius; | ||
final DSMessageBubbleStyle style; | ||
|
||
late final bool _isLightBubbleBackground; | ||
late final Color _foregroundColor; | ||
|
||
DSInteractiveVoiceCallMessageBubble({ | ||
super.key, | ||
required this.content, | ||
required this.align, | ||
this.borderRadius = const [DSBorderRadius.all], | ||
DSMessageBubbleStyle? style, | ||
}) : style = style ?? DSMessageBubbleStyle() { | ||
_initProperties(); | ||
} | ||
|
||
void _initProperties() { | ||
_isLightBubbleBackground = style.isLightBubbleBackground(align); | ||
|
||
_foregroundColor = _isLightBubbleBackground | ||
? DSColors.neutralDarkCity | ||
: DSColors.neutralLightSnow; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DSMessageBubble( | ||
align: align, | ||
style: style, | ||
borderRadius: borderRadius, | ||
child: Column( | ||
children: [ | ||
DSBodyText( | ||
content.body?.text, | ||
overflow: TextOverflow.visible, | ||
color: _foregroundColor, | ||
), | ||
content.action?.name == 'voice_call' | ||
? Column( | ||
children: [ | ||
const Padding( | ||
padding: EdgeInsets.symmetric( | ||
vertical: 8.0, | ||
), | ||
child: DSDivider(), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric( | ||
vertical: 8.0, | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Icon( | ||
DSIcons.voip_outline, | ||
color: _foregroundColor, | ||
), | ||
content.action?.parameters?.displayText != null | ||
? Padding( | ||
padding: const EdgeInsets.only( | ||
left: 8.0, | ||
), | ||
child: DSBodyText( | ||
content.action?.parameters?.displayText, | ||
overflow: TextOverflow.visible, | ||
color: _foregroundColor, | ||
), | ||
) | ||
: const SizedBox.shrink() | ||
], | ||
), | ||
), | ||
], | ||
) | ||
: const SizedBox.shrink(), | ||
], | ||
), | ||
); | ||
} | ||
} |
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