diff --git a/CHANGELOG.md b/CHANGELOG.md index 836b684e..47d10390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.0.97 + +- [DSFileMessageBubble] Added media ```text``` as property so it'll be displayed along with the file itself. +- [DSUserAvatar] Fixed overflow when passing a custom ```textStyle```. + ## 0.0.96 - [DSHeadlineExtraLargeTextStyle] Created text style primarily used by extra large titles. diff --git a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart index 1e5e046d..8b4f40ef 100644 --- a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart @@ -14,10 +14,12 @@ import '../texts/ds_body_text.widget.dart'; import '../texts/ds_caption_small_text.widget.dart'; import '../utils/ds_file_extension_icon.util.dart'; import 'ds_message_bubble.widget.dart'; +import 'ds_show_more_text.widget.dart'; class DSFileMessageBubble extends StatelessWidget { final DSAlign align; final String url; + final String? text; final int size; final String filename; final DSFileMessageBubbleController controller; @@ -34,6 +36,7 @@ class DSFileMessageBubble extends StatelessWidget { required this.url, required this.size, required this.filename, + this.text, this.borderRadius = const [DSBorderRadius.all], this.shouldAuthenticate = false, DSMessageBubbleStyle? style, @@ -60,15 +63,32 @@ class DSFileMessageBubble extends StatelessWidget { padding: EdgeInsets.zero, align: align, style: style, - child: SizedBox( - height: 80.0, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - _buildIcon(), - _buildText(), - ], - ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + _buildIcon(), + _buildTitle(), + ], + ), + if (text?.isNotEmpty ?? false) + Padding( + padding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 16.0, + ), + child: LayoutBuilder( + builder: (_, constraints) => DSShowMoreText( + text: text!, + maxWidth: constraints.maxWidth, + align: align, + style: style, + ), + ), + ) + ], ), ), ), @@ -78,6 +98,7 @@ class DSFileMessageBubble extends StatelessWidget { Widget _buildIcon() { return Container( width: 80.0, + height: 80.0, color: DSColors.neutralLightSnow, child: Obx( () => controller.isDownloading.value @@ -101,7 +122,7 @@ class DSFileMessageBubble extends StatelessWidget { ); } - Widget _buildText() { + Widget _buildTitle() { final color = style.isLightBubbleBackground(align) ? DSColors.neutralDarkCity : DSColors.neutralLightSnow; @@ -131,7 +152,7 @@ class DSFileMessageBubble extends StatelessWidget { controller.getFileSize(size), color: color, ), - ) + ), ], ), ), diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index 56729ed2..f69a4608 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -323,6 +323,7 @@ class DSCard extends StatelessWidget { return DSFileMessageBubble( align: align, url: media.uri, + text: media.text, replyContent: replyContent, size: size, filename: media.title ?? diff --git a/lib/src/widgets/utils/ds_group_card.widget.dart b/lib/src/widgets/utils/ds_group_card.widget.dart index 012e738b..331a6f38 100644 --- a/lib/src/widgets/utils/ds_group_card.widget.dart +++ b/lib/src/widgets/utils/ds_group_card.widget.dart @@ -9,6 +9,7 @@ import '../../models/ds_message_bubble_style.model.dart'; import '../../models/ds_message_item.model.dart'; import '../../themes/colors/ds_colors.theme.dart'; import '../../themes/icons/ds_icons.dart'; +import '../../themes/texts/styles/ds_caption_small_text_style.theme.dart'; import '../../utils/ds_animate.util.dart'; import '../../utils/ds_message_content_type.util.dart'; import '../../utils/ds_utils.util.dart'; @@ -284,6 +285,7 @@ class _DSGroupCardState extends State { : Alignment.bottomLeft, child: DSUserAvatar( radius: 12, + textStyle: const DSCaptionSmallTextStyle(), uri: sentMessage ? widget.avatarConfig.sentAvatar : widget.avatarConfig.receivedAvatar, diff --git a/lib/src/widgets/utils/ds_user_avatar.widget.dart b/lib/src/widgets/utils/ds_user_avatar.widget.dart index 16bac8d4..b8a97934 100644 --- a/lib/src/widgets/utils/ds_user_avatar.widget.dart +++ b/lib/src/widgets/utils/ds_user_avatar.widget.dart @@ -14,7 +14,7 @@ class DSUserAvatar extends StatelessWidget { final Color backgroundColor; final TextStyle textStyle; - static const _defaultTextStyle = TextStyle( + static const _defaultTextStyle = DSBodyTextStyle( color: DSColors.neutralDarkCity, overflow: TextOverflow.clip, ); @@ -25,8 +25,11 @@ class DSUserAvatar extends StatelessWidget { this.uri, this.radius = 25.0, this.backgroundColor = DSColors.primaryGreensTrue, - TextStyle textStyle = const DSBodyTextStyle(), - }) : textStyle = _defaultTextStyle.merge(textStyle); + TextStyle textStyle = _defaultTextStyle, + }) : textStyle = textStyle.copyWith( + color: textStyle.color ?? _defaultTextStyle.color, + overflow: _defaultTextStyle.overflow, + ); @override Widget build(BuildContext context) => uri != null diff --git a/pubspec.yaml b/pubspec.yaml index c10589b4..a0690881 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.0.96 +version: 0.0.97 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter diff --git a/sample/lib/main.dart b/sample/lib/main.dart index bfb921e2..08e63c52 100644 --- a/sample/lib/main.dart +++ b/sample/lib/main.dart @@ -1,7 +1,7 @@ import 'package:blip_ds/blip_ds.dart'; import 'package:flutter/material.dart'; import 'package:get/route_manager.dart'; -import 'package:sample/widgets/showcase/sample_user_avatar.showcas.dart'; +import 'package:sample/widgets/showcase/sample_user_avatar.showcase.dart'; import 'widgets/showcase/sample_bottom_sheet.showcase.dart'; import 'widgets/showcase/sample_button.showcase.dart'; diff --git a/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart b/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart index 07d10eb7..76ff0196 100644 --- a/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart +++ b/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart @@ -350,6 +350,8 @@ class SampleMessageBubbleShowcase extends StatelessWidget { align: DSAlign.right, ), DSFileMessageBubble( + text: + 'Texto de exemplo para exemplificar uma descrição enviado junto com um File.', align: DSAlign.left, filename: 'teste.pdf', size: 0, diff --git a/sample/lib/widgets/showcase/sample_user_avatar.showcas.dart b/sample/lib/widgets/showcase/sample_user_avatar.showcas.dart deleted file mode 100644 index 19385818..00000000 --- a/sample/lib/widgets/showcase/sample_user_avatar.showcas.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:blip_ds/blip_ds.dart'; -import 'package:flutter/material.dart'; - -class SampleUserAvatarShowcase extends StatelessWidget { - const SampleUserAvatarShowcase({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - DSUserAvatar( - text: "Adriano Chamon Tavares", - ), - const SizedBox( - height: 15, - ), - DSUserAvatar( - text: "Adriano Chamon Tavares", - textStyle: const DSHeadlineLargeTextStyle(), - ), - const SizedBox( - height: 15, - ), - DSUserAvatar( - text: "Adriano Chamon Tavares", - textStyle: const DSHeadlineExtraLargeTextStyle(), - ), - const SizedBox( - height: 15, - ), - ], - ); - } -} diff --git a/sample/lib/widgets/showcase/sample_user_avatar.showcase.dart b/sample/lib/widgets/showcase/sample_user_avatar.showcase.dart new file mode 100644 index 00000000..c104db9f --- /dev/null +++ b/sample/lib/widgets/showcase/sample_user_avatar.showcase.dart @@ -0,0 +1,59 @@ +import 'package:blip_ds/blip_ds.dart'; +import 'package:flutter/material.dart'; + +class SampleUserAvatarShowcase extends StatelessWidget { + const SampleUserAvatarShowcase({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + DSUserAvatar( + text: "Adriano Chamon Tavares", + radius: 12.0, + textStyle: const DSCaptionSmallTextStyle(), + ), + const SizedBox( + height: 15, + ), + DSUserAvatar( + text: "Adriano Chamon Tavares", + radius: 16.0, + textStyle: const DSCaptionTextStyle(), + ), + const SizedBox( + height: 15, + ), + DSUserAvatar( + text: "Adriano Chamon Tavares", + radius: 12.0, + textStyle: const DSBodyTextStyle(), + ), + const SizedBox( + height: 15, + ), + DSUserAvatar( + text: "Adriano Chamon Tavares", + textStyle: const DSHeadlineLargeTextStyle( + color: DSColors.illustrationBlueGenie, + ), + backgroundColor: DSColors.contentGhost, + ), + const SizedBox( + height: 15, + ), + DSUserAvatar( + text: "Adriano Chamon Tavares", + radius: 40.0, + textStyle: const DSHeadlineExtraLargeTextStyle( + color: DSColors.extendRedsLipstick, + ), + backgroundColor: DSColors.extendBrownsCheetos, + ), + const SizedBox( + height: 15, + ), + ], + ); + } +} diff --git a/sample/pubspec.lock b/sample/pubspec.lock index 5ddd61b8..e9fc58b6 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -31,7 +31,7 @@ packages: path: ".." relative: true source: path - version: "0.0.95" + version: "0.0.97" boolean_selector: dependency: transitive description: