Skip to content
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v1.0.0-beta.6 (Nov 29, 2024)

### Features
- Added a `chooseMedia` parameter in `SendbirdUIKit.init()`

### Improvements
- Fixed to support tree-shake-icons option when building applications
- Fixed some UI bugs

## v1.0.0-beta.5 (Nov 15, 2024)

### Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Add following dependencies and fonts for `SendbirdIcons` in `pubspec.yaml`.

```yaml
dependencies:
sendbird_uikit: ^1.0.0-beta.5
sendbird_chat_sdk: ^4.2.28
sendbird_uikit: ^1.0.0-beta.6
sendbird_chat_sdk: ^4.2.29

flutter:
fonts:
Expand Down
8 changes: 4 additions & 4 deletions lib/src/internal/component/base/sbu_base_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ mixin SBUBaseComponent {
return SendbirdUIKit().choosePhoto != null;
}

bool canChooseMedia() {
return SendbirdUIKit().chooseMedia != null;
}

bool canChooseDocument() {
return SendbirdUIKit().chooseDocument != null;
}
Expand Down Expand Up @@ -406,10 +410,6 @@ mixin SBUBaseComponent {
return (message.isReplyToChannel && message.parentMessage != null);
}

bool isReplyMessage(BaseMessage message) {
return (!message.isReplyToChannel && message.parentMessage != null);
}

// Test
bool isThemeTestOn() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,56 +51,59 @@ class SBUBottomSheetMenuComponentState
final errorColorIndex = widget.errorColorIndex;
final disabledNames = widget.disabledNames;

return Container(
decoration: BoxDecoration(
color: isLightTheme ? SBUColors.background50 : SBUColors.background500,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
return SafeArea(
child: Container(
decoration: BoxDecoration(
color:
isLightTheme ? SBUColors.background50 : SBUColors.background500,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_getReactionWidget(channel, message, isLightTheme),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: buttonNames.mapIndexed((index, iconName) {
final isError = (errorColorIndex == index);
final isDisabled =
disabledNames?.any((name) => name == buttonNames[index]) ??
false;
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_getReactionWidget(channel, message, isLightTheme),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: buttonNames.mapIndexed((index, iconName) {
final isError = (errorColorIndex == index);
final isDisabled =
disabledNames?.any((name) => name == buttonNames[index]) ??
false;

return Material(
color: Colors.transparent,
child: isDisabled
? _menuItem(
index: index,
iconNames: iconNames,
buttonNames: buttonNames,
isError: isError,
isDisabled: isDisabled,
isLightTheme: isLightTheme,
)
: InkWell(
onTap: () {
Navigator.pop(context);
onButtonClicked(buttonNames[index]);
},
child: _menuItem(
return Material(
color: Colors.transparent,
child: isDisabled
? _menuItem(
index: index,
iconNames: iconNames,
buttonNames: buttonNames,
isError: isError,
isDisabled: isDisabled,
isLightTheme: isLightTheme,
)
: InkWell(
onTap: () {
Navigator.pop(context);
onButtonClicked(buttonNames[index]);
},
child: _menuItem(
index: index,
iconNames: iconNames,
buttonNames: buttonNames,
isError: isError,
isDisabled: isDisabled,
isLightTheme: isLightTheme,
),
),
),
);
}).toList(),
),
],
);
}).toList(),
),
],
),
),
);
}
Expand Down Expand Up @@ -227,6 +230,7 @@ class SBUBottomSheetMenuComponentState
Navigator.pop(context);
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/internal/component/basic/sbu_reaction_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
if (reaction.key == addReactionKey) {
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand All @@ -144,6 +145,7 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
if (reaction.key != addReactionKey) {
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand All @@ -157,7 +159,6 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
selectedReaction: reaction,
);
},
isScrollControlled: true, // Check
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand All @@ -224,7 +225,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
SBUIcons.camera,
if (widget.canTakeVideo())
SBUIcons.camera,
if (widget.canChoosePhoto())
if (widget.canChooseMedia())
SBUIcons.photo,
if (widget.canChooseDocument())
SBUIcons.document,
Expand All @@ -234,7 +235,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
strings.takePhoto,
if (widget.canTakeVideo())
strings.takeVideo,
if (widget.canChoosePhoto())
if (widget.canChooseMedia())
strings.gallery,
if (widget.canChooseDocument())
strings.document,
Expand All @@ -253,7 +254,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
} else if (buttonName ==
strings.gallery) {
fileInfo = await SendbirdUIKit()
.choosePhoto!();
.chooseMedia!();
} else if (buttonName ==
strings.document) {
fileInfo = await SendbirdUIKit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'dart:async';

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -559,6 +560,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -590,7 +592,7 @@ class SBUMessageListItemComponentState
children: [
if (isSameMinuteAtPreviousMessage == false)
if (message.isReplyToChannel == false &&
message.parentMessage == null)
message.parentMessageId == null)
Padding(
padding: const EdgeInsets.only(left: 12, bottom: 4),
child: SBUTextComponent(
Expand All @@ -611,6 +613,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -798,6 +801,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -882,6 +886,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -1012,6 +1017,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -1043,7 +1049,7 @@ class SBUMessageListItemComponentState
children: [
if (isSameMinuteAtPreviousMessage == false)
if (message.isReplyToChannel == false &&
message.parentMessage == null)
message.parentMessageId == null)
Padding(
padding: const EdgeInsets.only(left: 12, bottom: 4),
child: SBUTextComponent(
Expand All @@ -1068,6 +1074,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -1266,6 +1273,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -1360,6 +1368,7 @@ class SBUMessageListItemComponentState
widget.unfocus();
await showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
Expand Down Expand Up @@ -1478,10 +1487,6 @@ class SBUMessageListItemComponentState
child: child,
);

if (widget.isReplyMessage(message)) {
result = Container(); // Check
}

return result;
}

Expand Down Expand Up @@ -1633,9 +1638,18 @@ class SBUMessageListItemComponentState
Widget result = child;

if (widget.isReplyMessageToChannel(message)) {
BaseMessage parentMessage = message.parentMessage!;
if (message.parentMessageId != null) {
final updatableMessage = collection.messageList
.firstWhereOrNull((m) => m.messageId == message.parentMessageId);
if (updatableMessage != null) {
parentMessage = updatableMessage;
}
}

Widget parentMessageItemWidget = _parentMessageItemWidget(
collection: collection,
message: message.parentMessage!,
message: parentMessage,
isSameMinuteAtPreviousMessage: isSameMinuteAtPreviousMessage,
isSameMinuteAtNextMessage: isSameMinuteAtNextMessage,
timeString: timeString,
Expand Down Expand Up @@ -1683,8 +1697,6 @@ class SBUMessageListItemComponentState
),
],
);
} else if (widget.isReplyMessage(message)) {
result = Container(); // Check
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SBUMessageCollectionProvider with ChangeNotifier {
if (params != null && params.replyType != null) {
replyType = params.replyType;
} else if (SBUReplyManager().isQuoteReplyAvailable(channel)) {
replyType = ReplyType.all;
replyType = ReplyType.onlyReplyToChannel;
}

final collection = MessageCollection(
Expand Down
Loading