diff --git a/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart b/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart index f33f142f..7d5bd194 100644 --- a/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart +++ b/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart @@ -37,43 +37,41 @@ class DSAudioMessageBubble extends StatelessWidget { align: align, replyContent: replyContent, style: style, - padding: const EdgeInsets.only( - left: 4.0, - right: 8.0, - top: 8.0, - bottom: 8.0, - ), - child: DSAudioPlayer( - uri: uri, - shouldAuthenticate: shouldAuthenticate, - controlForegroundColor: isLightBubbleBackground - ? DSColors.neutralDarkRooftop - : DSColors.neutralLightSnow, - labelColor: isLightBubbleBackground - ? DSColors.neutralDarkCity - : DSColors.neutralLightSnow, - bufferActiveTrackColor: isLightBubbleBackground - ? DSColors.neutralMediumWave - : DSColors.neutralMediumElephant, - bufferInactiveTrackColor: isLightBubbleBackground - ? DSColors.neutralDarkRooftop - : DSColors.neutralLightBox, - sliderActiveTrackColor: isLightBubbleBackground - ? DSColors.primaryNight - : DSColors.primaryLight, - sliderThumbColor: isLightBubbleBackground - ? DSColors.neutralDarkRooftop - : DSColors.neutralLightSnow, - speedForegroundColor: isLightBubbleBackground - ? DSColors.neutralDarkCity - : DSColors.neutralLightSnow, - speedBorderColor: isLightBubbleBackground - ? isDefaultBubbleColors - ? DSColors.neutralMediumSilver - : DSColors.neutralDarkCity - : isDefaultBubbleColors - ? DSColors.disabledText - : DSColors.neutralLightSnow, + padding: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.fromLTRB(4.0, 8.0, 8.0, 8.0), + child: DSAudioPlayer( + uri: uri, + shouldAuthenticate: shouldAuthenticate, + controlForegroundColor: isLightBubbleBackground + ? DSColors.neutralDarkRooftop + : DSColors.neutralLightSnow, + labelColor: isLightBubbleBackground + ? DSColors.neutralDarkCity + : DSColors.neutralLightSnow, + bufferActiveTrackColor: isLightBubbleBackground + ? DSColors.neutralMediumWave + : DSColors.neutralMediumElephant, + bufferInactiveTrackColor: isLightBubbleBackground + ? DSColors.neutralDarkRooftop + : DSColors.neutralLightBox, + sliderActiveTrackColor: isLightBubbleBackground + ? DSColors.primaryNight + : DSColors.primaryLight, + sliderThumbColor: isLightBubbleBackground + ? DSColors.neutralDarkRooftop + : DSColors.neutralLightSnow, + speedForegroundColor: isLightBubbleBackground + ? DSColors.neutralDarkCity + : DSColors.neutralLightSnow, + speedBorderColor: isLightBubbleBackground + ? isDefaultBubbleColors + ? DSColors.neutralMediumSilver + : DSColors.neutralDarkCity + : isDefaultBubbleColors + ? DSColors.disabledText + : DSColors.neutralLightSnow, + ), ), ); } diff --git a/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart b/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart index 29d4ecd1..1c7f930e 100644 --- a/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart @@ -36,7 +36,7 @@ class DSContactMessageBubble extends StatelessWidget { return DSMessageBubble( align: align, borderRadius: borderRadius, - padding: const EdgeInsets.all(16.0), + padding: EdgeInsets.zero, shouldUseDefaultSize: true, style: style, replyContent: replyContent, @@ -48,44 +48,51 @@ class DSContactMessageBubble extends StatelessWidget { final foregroundColor = style.isLightBubbleBackground(align) ? DSColors.neutralDarkCity : DSColors.neutralLightSnow; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Visibility( - visible: name != null, - child: DSBodyText( - name, - fontWeight: DSFontWeights.semiBold, - color: foregroundColor, - overflow: TextOverflow.visible, - ), - ), - const SizedBox(height: 16.0), - /// TODO(format): Format phone number - if (phone != null) - Padding( - padding: const EdgeInsets.only(bottom: 4.0), - child: _buildContactField( - title: 'Telefone', - body: phone!, - foregroundColor: foregroundColor), + return Padding( + padding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 16.0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Visibility( + visible: name != null, + child: DSBodyText( + name, + fontWeight: DSFontWeights.semiBold, + color: foregroundColor, + overflow: TextOverflow.visible, + ), ), - if (email != null) - Padding( - padding: const EdgeInsets.only(bottom: 4.0), - child: _buildContactField( - title: 'E-mail', - body: email!, - foregroundColor: foregroundColor), - ), - if (address != null) - _buildContactField( - title: 'Endereço', - body: address!, - foregroundColor: foregroundColor, - ), - ], + const SizedBox(height: 16.0), + + /// TODO(format): Format phone number + if (phone != null) + Padding( + padding: const EdgeInsets.only(bottom: 4.0), + child: _buildContactField( + title: 'Telefone', + body: phone!, + foregroundColor: foregroundColor), + ), + if (email != null) + Padding( + padding: const EdgeInsets.only(bottom: 4.0), + child: _buildContactField( + title: 'E-mail', + body: email!, + foregroundColor: foregroundColor), + ), + if (address != null) + _buildContactField( + title: 'Endereço', + body: address!, + foregroundColor: foregroundColor, + ), + ], + ), ); } diff --git a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart index 3d441bda..df2d0d0e 100644 --- a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart @@ -92,79 +92,84 @@ class _DSImageMessageBubbleState extends State padding: EdgeInsets.zero, hasSpacer: widget.hasSpacer, style: widget.style, - child: LayoutBuilder( - builder: (_, constraints) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Obx( - () => _controller.localPath.value != null - ? DSExpandedImage( - appBarText: widget.appBarText, - appBarPhotoUri: widget.appBarPhotoUri, - url: _controller.localPath.value!, - maxHeight: widget.imageMaxHeight != null - ? widget.imageMaxHeight! - : widget.showSelect - ? 200.0 - : double.infinity, - minHeight: widget.imageMinHeight != null - ? widget.imageMinHeight! - : widget.showSelect - ? 200.0 - : 0.0, - align: widget.align, - style: widget.style, - isLoading: false, - shouldAuthenticate: widget.shouldAuthenticate, - ) - : DSCircularProgress( - currentProgress: _controller.downloadProgress, - maximumProgress: _controller.maximumProgress, - foregroundColor: foregroundColor, + child: Padding( + padding: widget.replyContent == null + ? EdgeInsets.zero + : const EdgeInsets.only(top: 8.0), + child: LayoutBuilder( + builder: (_, constraints) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Obx( + () => _controller.localPath.value != null + ? DSExpandedImage( + appBarText: widget.appBarText, + appBarPhotoUri: widget.appBarPhotoUri, + url: _controller.localPath.value!, + maxHeight: widget.imageMaxHeight != null + ? widget.imageMaxHeight! + : widget.showSelect + ? 200.0 + : double.infinity, + minHeight: widget.imageMinHeight != null + ? widget.imageMinHeight! + : widget.showSelect + ? 200.0 + : 0.0, + align: widget.align, + style: widget.style, + isLoading: false, + shouldAuthenticate: widget.shouldAuthenticate, + ) + : DSCircularProgress( + currentProgress: _controller.downloadProgress, + maximumProgress: _controller.maximumProgress, + foregroundColor: foregroundColor, + ), + ), + if ((widget.title?.isNotEmpty ?? false) || + (widget.text?.isNotEmpty ?? false)) + SizedBox( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.title?.isNotEmpty ?? false) + DSCaptionText( + widget.title!, + color: foregroundColor, + isSelectable: true, + ), + if ((widget.text?.isNotEmpty ?? false) && + (widget.title?.isNotEmpty ?? false)) + const SizedBox( + height: 6.0, + ), + if (widget.text?.isNotEmpty ?? false) + DSShowMoreText( + text: widget.text!, + maxWidth: constraints.maxWidth, + align: widget.align, + style: widget.style, + ) + ], ), - ), - if ((widget.title?.isNotEmpty ?? false) || - (widget.text?.isNotEmpty ?? false)) - SizedBox( - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.title?.isNotEmpty ?? false) - DSCaptionText( - widget.title!, - color: foregroundColor, - isSelectable: true, - ), - if ((widget.text?.isNotEmpty ?? false) && - (widget.title?.isNotEmpty ?? false)) - const SizedBox( - height: 6.0, - ), - if (widget.text?.isNotEmpty ?? false) - DSShowMoreText( - text: widget.text!, - maxWidth: constraints.maxWidth, - align: widget.align, - style: widget.style, - ) - ], ), ), - ), - if (widget.showSelect) - DSDocumentSelect( - align: widget.align, - options: widget.selectOptions, - onSelected: widget.onSelected, - onOpenLink: widget.onOpenLink, - style: widget.style, - ), - ], - ); - }, + if (widget.showSelect) + DSDocumentSelect( + align: widget.align, + options: widget.selectOptions, + onSelected: widget.onSelected, + onOpenLink: widget.onOpenLink, + style: widget.style, + ), + ], + ); + }, + ), ), ); } diff --git a/lib/src/widgets/chat/ds_location_message_bubble.widget.dart b/lib/src/widgets/chat/ds_location_message_bubble.widget.dart index 924e666e..f2a7d846 100644 --- a/lib/src/widgets/chat/ds_location_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_location_message_bubble.widget.dart @@ -62,46 +62,51 @@ class DSLocationMessageBubble extends StatelessWidget { padding: EdgeInsets.zero, align: align, style: style, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - hasValidCoordinates - ? DSCachedNetworkImageView( - url: - 'https://maps.googleapis.com/maps/api/staticmap?&size=360x360&markers=$latitude,$longitude&key=${DSAuthService.googleKey}', - placeholder: (_, __) => _buildLoading(), - align: align, - style: style, - ) - : SizedBox( - width: 240, - height: 240, - child: Icon( - DSIcons.file_image_broken_outline, - size: 80, - color: style.isLightBubbleBackground(align) - ? DSColors.neutralMediumElephant - : DSColors.neutralMediumCloud, + child: Padding( + padding: replyContent == null + ? EdgeInsets.zero + : const EdgeInsets.only(top: 8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + hasValidCoordinates + ? DSCachedNetworkImageView( + url: + 'https://maps.googleapis.com/maps/api/staticmap?&size=360x360&markers=$latitude,$longitude&key=${DSAuthService.googleKey}', + placeholder: (_, __) => _buildLoading(), + align: align, + style: style, + ) + : SizedBox( + width: 240, + height: 240, + child: Icon( + DSIcons.file_image_broken_outline, + size: 80, + color: style.isLightBubbleBackground(align) + ? DSColors.neutralMediumElephant + : DSColors.neutralMediumCloud, + ), ), + if (title?.isNotEmpty ?? false) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 8.0, ), - if (title?.isNotEmpty ?? false) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Align( - alignment: Alignment.topLeft, - child: DSBodyText( - title!, - color: foregroundColor, - isSelectable: true, - overflow: TextOverflow.visible, + child: Align( + alignment: Alignment.topLeft, + child: DSBodyText( + title!, + color: foregroundColor, + isSelectable: true, + overflow: TextOverflow.visible, + ), ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart b/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart index 416489c1..2c3cfa8c 100644 --- a/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart +++ b/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart @@ -116,6 +116,8 @@ class _DSVideoMessageBubbleState extends State : DSColors.neutralDarkCity; return DSMessageBubble( + defaultMaxSize: 240, + shouldUseDefaultSize: true, align: widget.align, borderRadius: widget.borderRadius, padding: EdgeInsets.zero, @@ -126,68 +128,76 @@ class _DSVideoMessageBubbleState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Obx( - () => SizedBox( - height: 240, - width: 240, - child: _controller.hasError.value - ? const Icon( - DSIcons.video_broken_outline, - size: 80.0, - color: DSColors.neutralDarkRooftop, - ) - : _controller.isDownloading.value - ? DSCircularProgress( - currentProgress: _controller.downloadProgress, - maximumProgress: _controller.maximumProgress, - foregroundColor: foregroundColor, - ) - : _controller.thumbnail.isEmpty - ? Center( - child: SizedBox( - height: 40, - child: DSButton( - leadingIcon: const Icon( - DSIcons.download_outline, - size: 20, + () => Padding( + padding: widget.replyContent == null + ? EdgeInsets.zero + : const EdgeInsets.only(top: 8.0), + child: SizedBox( + height: 240, + width: 240, + child: _controller.hasError.value + ? const Icon( + DSIcons.video_broken_outline, + size: 80.0, + color: DSColors.neutralDarkRooftop, + ) + : _controller.isDownloading.value + ? DSCircularProgress( + currentProgress: _controller.downloadProgress, + maximumProgress: _controller.maximumProgress, + foregroundColor: foregroundColor, + ) + : _controller.thumbnail.isEmpty + ? Center( + child: SizedBox( + height: 40, + child: DSButton( + leadingIcon: const Icon( + DSIcons.download_outline, + size: 20, + ), + backgroundColor: buttonBackgroundColor, + foregroundColor: buttonForegroundColor, + borderColor: buttonBorderColor, + label: _controller.size(), + onPressed: _controller.downloadVideo, ), - backgroundColor: buttonBackgroundColor, - foregroundColor: buttonForegroundColor, - borderColor: buttonBorderColor, - label: _controller.size(), - onPressed: _controller.downloadVideo, ), - ), - ) - : DSVideoBody( - align: widget.align, - appBarPhotoUri: widget.appBarPhotoUri, - appBarText: widget.appBarText, - url: widget.url, - shouldAuthenticate: widget.shouldAuthenticate, - thumbnail: Center( - child: Image.file( - File( - _controller.thumbnail.value, + ) + : DSVideoBody( + align: widget.align, + appBarPhotoUri: widget.appBarPhotoUri, + appBarText: widget.appBarText, + url: widget.url, + shouldAuthenticate: widget.shouldAuthenticate, + thumbnail: Center( + child: Image.file( + File( + _controller.thumbnail.value, + ), + width: 240, + height: 240, + fit: BoxFit.cover, ), - width: 240, - height: 240, - fit: BoxFit.cover, ), ), - ), + ), ), ), if (widget.text?.isNotEmpty ?? false) - Padding( - padding: const EdgeInsets.symmetric( - vertical: 8.0, - horizontal: 16.0, - ), - child: DSShowMoreText( - text: widget.text!, - align: widget.align, - style: widget.style, - maxWidth: constraints.maxWidth, + SizedBox( + width: 240, + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 8.0, + horizontal: 16.0, + ), + child: DSShowMoreText( + text: widget.text!, + align: widget.align, + style: widget.style, + maxWidth: constraints.maxWidth, + ), ), ), ],