Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] 0.0.97 #249

Merged
merged 7 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
43 changes: 32 additions & 11 deletions lib/src/widgets/chat/ds_file_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
),
),
)
],
),
),
),
Expand All @@ -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
Expand All @@ -101,7 +122,7 @@ class DSFileMessageBubble extends StatelessWidget {
);
}

Widget _buildText() {
Widget _buildTitle() {
final color = style.isLightBubbleBackground(align)
? DSColors.neutralDarkCity
: DSColors.neutralLightSnow;
Expand Down Expand Up @@ -131,7 +152,7 @@ class DSFileMessageBubble extends StatelessWidget {
controller.getFileSize(size),
color: color,
),
)
),
],
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/utils/ds_card.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
Expand Down
2 changes: 2 additions & 0 deletions lib/src/widgets/utils/ds_group_card.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -284,6 +285,7 @@ class _DSGroupCardState extends State<DSGroupCard> {
: Alignment.bottomLeft,
child: DSUserAvatar(
radius: 12,
textStyle: const DSCaptionSmallTextStyle(),
uri: sentMessage
? widget.avatarConfig.sentAvatar
: widget.avatarConfig.receivedAvatar,
Expand Down
9 changes: 6 additions & 3 deletions lib/src/widgets/utils/ds_user_avatar.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion sample/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
34 changes: 0 additions & 34 deletions sample/lib/widgets/showcase/sample_user_avatar.showcas.dart

This file was deleted.

59 changes: 59 additions & 0 deletions sample/lib/widgets/showcase/sample_user_avatar.showcase.dart
Original file line number Diff line number Diff line change
@@ -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,
),
],
);
}
}
2 changes: 1 addition & 1 deletion sample/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.95"
version: "0.0.97"
boolean_selector:
dependency: transitive
description:
Expand Down