Skip to content

Commit 9fc0ae3

Browse files
Merge pull request #10 from sendbird/v1.0.0-beta.6
Add 1.0.0-beta.6.
2 parents 2488d28 + aee056d commit 9fc0ae3

13 files changed

+159
-124
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## v1.0.0-beta.6 (Nov 29, 2024)
2+
3+
### Features
4+
- Added a `chooseMedia` parameter in `SendbirdUIKit.init()`
5+
6+
### Improvements
7+
- Fixed to support tree-shake-icons option when building applications
8+
- Fixed some UI bugs
9+
110
## v1.0.0-beta.5 (Nov 15, 2024)
211

312
### Features

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Add following dependencies and fonts for `SendbirdIcons` in `pubspec.yaml`.
3838

3939
```yaml
4040
dependencies:
41-
sendbird_uikit: ^1.0.0-beta.5
42-
sendbird_chat_sdk: ^4.2.28
41+
sendbird_uikit: ^1.0.0-beta.6
42+
sendbird_chat_sdk: ^4.2.29
4343

4444
flutter:
4545
fonts:

lib/src/internal/component/base/sbu_base_component.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ mixin SBUBaseComponent {
345345
return SendbirdUIKit().choosePhoto != null;
346346
}
347347

348+
bool canChooseMedia() {
349+
return SendbirdUIKit().chooseMedia != null;
350+
}
351+
348352
bool canChooseDocument() {
349353
return SendbirdUIKit().chooseDocument != null;
350354
}
@@ -406,10 +410,6 @@ mixin SBUBaseComponent {
406410
return (message.isReplyToChannel && message.parentMessage != null);
407411
}
408412

409-
bool isReplyMessage(BaseMessage message) {
410-
return (!message.isReplyToChannel && message.parentMessage != null);
411-
}
412-
413413
// Test
414414
bool isThemeTestOn() {
415415
return false;

lib/src/internal/component/basic/sbu_bottom_sheet_menu_component.dart

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,56 +51,59 @@ class SBUBottomSheetMenuComponentState
5151
final errorColorIndex = widget.errorColorIndex;
5252
final disabledNames = widget.disabledNames;
5353

54-
return Container(
55-
decoration: BoxDecoration(
56-
color: isLightTheme ? SBUColors.background50 : SBUColors.background500,
57-
borderRadius: const BorderRadius.only(
58-
topLeft: Radius.circular(8),
59-
topRight: Radius.circular(8),
54+
return SafeArea(
55+
child: Container(
56+
decoration: BoxDecoration(
57+
color:
58+
isLightTheme ? SBUColors.background50 : SBUColors.background500,
59+
borderRadius: const BorderRadius.only(
60+
topLeft: Radius.circular(8),
61+
topRight: Radius.circular(8),
62+
),
6063
),
61-
),
62-
child: Column(
63-
mainAxisSize: MainAxisSize.min,
64-
children: [
65-
_getReactionWidget(channel, message, isLightTheme),
66-
Column(
67-
mainAxisSize: MainAxisSize.min,
68-
crossAxisAlignment: CrossAxisAlignment.start,
69-
children: buttonNames.mapIndexed((index, iconName) {
70-
final isError = (errorColorIndex == index);
71-
final isDisabled =
72-
disabledNames?.any((name) => name == buttonNames[index]) ??
73-
false;
64+
child: Column(
65+
mainAxisSize: MainAxisSize.min,
66+
children: [
67+
_getReactionWidget(channel, message, isLightTheme),
68+
Column(
69+
mainAxisSize: MainAxisSize.min,
70+
crossAxisAlignment: CrossAxisAlignment.start,
71+
children: buttonNames.mapIndexed((index, iconName) {
72+
final isError = (errorColorIndex == index);
73+
final isDisabled =
74+
disabledNames?.any((name) => name == buttonNames[index]) ??
75+
false;
7476

75-
return Material(
76-
color: Colors.transparent,
77-
child: isDisabled
78-
? _menuItem(
79-
index: index,
80-
iconNames: iconNames,
81-
buttonNames: buttonNames,
82-
isError: isError,
83-
isDisabled: isDisabled,
84-
isLightTheme: isLightTheme,
85-
)
86-
: InkWell(
87-
onTap: () {
88-
Navigator.pop(context);
89-
onButtonClicked(buttonNames[index]);
90-
},
91-
child: _menuItem(
77+
return Material(
78+
color: Colors.transparent,
79+
child: isDisabled
80+
? _menuItem(
9281
index: index,
9382
iconNames: iconNames,
9483
buttonNames: buttonNames,
9584
isError: isError,
9685
isDisabled: isDisabled,
9786
isLightTheme: isLightTheme,
87+
)
88+
: InkWell(
89+
onTap: () {
90+
Navigator.pop(context);
91+
onButtonClicked(buttonNames[index]);
92+
},
93+
child: _menuItem(
94+
index: index,
95+
iconNames: iconNames,
96+
buttonNames: buttonNames,
97+
isError: isError,
98+
isDisabled: isDisabled,
99+
isLightTheme: isLightTheme,
100+
),
98101
),
99-
),
100-
);
101-
}).toList(),
102-
),
103-
],
102+
);
103+
}).toList(),
104+
),
105+
],
106+
),
104107
),
105108
);
106109
}
@@ -227,6 +230,7 @@ class SBUBottomSheetMenuComponentState
227230
Navigator.pop(context);
228231
await showModalBottomSheet(
229232
context: context,
233+
isScrollControlled: true,
230234
shape: const RoundedRectangleBorder(
231235
borderRadius: BorderRadius.only(
232236
topLeft: Radius.circular(8),

lib/src/internal/component/basic/sbu_reaction_component.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
122122
if (reaction.key == addReactionKey) {
123123
await showModalBottomSheet(
124124
context: context,
125+
isScrollControlled: true,
125126
shape: const RoundedRectangleBorder(
126127
borderRadius: BorderRadius.only(
127128
topLeft: Radius.circular(8),
@@ -144,6 +145,7 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
144145
if (reaction.key != addReactionKey) {
145146
await showModalBottomSheet(
146147
context: context,
148+
isScrollControlled: true,
147149
shape: const RoundedRectangleBorder(
148150
borderRadius: BorderRadius.only(
149151
topLeft: Radius.circular(8),
@@ -157,7 +159,6 @@ class SBUReactionComponentState extends State<SBUReactionComponent> {
157159
selectedReaction: reaction,
158160
);
159161
},
160-
isScrollControlled: true, // Check
161162
);
162163
}
163164
},

lib/src/internal/component/module/sbu_message_input_component.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
211211
widget.unfocus();
212212
await showModalBottomSheet(
213213
context: context,
214+
isScrollControlled: true,
214215
shape: const RoundedRectangleBorder(
215216
borderRadius: BorderRadius.only(
216217
topLeft: Radius.circular(8),
@@ -224,7 +225,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
224225
SBUIcons.camera,
225226
if (widget.canTakeVideo())
226227
SBUIcons.camera,
227-
if (widget.canChoosePhoto())
228+
if (widget.canChooseMedia())
228229
SBUIcons.photo,
229230
if (widget.canChooseDocument())
230231
SBUIcons.document,
@@ -234,7 +235,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
234235
strings.takePhoto,
235236
if (widget.canTakeVideo())
236237
strings.takeVideo,
237-
if (widget.canChoosePhoto())
238+
if (widget.canChooseMedia())
238239
strings.gallery,
239240
if (widget.canChooseDocument())
240241
strings.document,
@@ -253,7 +254,7 @@ class SBUMessageInputComponentState extends State<SBUMessageInputComponent> {
253254
} else if (buttonName ==
254255
strings.gallery) {
255256
fileInfo = await SendbirdUIKit()
256-
.choosePhoto!();
257+
.chooseMedia!();
257258
} else if (buttonName ==
258259
strings.document) {
259260
fileInfo = await SendbirdUIKit()

lib/src/internal/component/module/sbu_message_list_item_component.dart

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import 'dart:async';
44

5+
import 'package:collection/collection.dart';
56
import 'package:flutter/material.dart';
67
import 'package:intl/intl.dart';
78
import 'package:provider/provider.dart';
@@ -559,6 +560,7 @@ class SBUMessageListItemComponentState
559560
widget.unfocus();
560561
await showModalBottomSheet(
561562
context: context,
563+
isScrollControlled: true,
562564
shape: const RoundedRectangleBorder(
563565
borderRadius: BorderRadius.only(
564566
topLeft: Radius.circular(8),
@@ -590,7 +592,7 @@ class SBUMessageListItemComponentState
590592
children: [
591593
if (isSameMinuteAtPreviousMessage == false)
592594
if (message.isReplyToChannel == false &&
593-
message.parentMessage == null)
595+
message.parentMessageId == null)
594596
Padding(
595597
padding: const EdgeInsets.only(left: 12, bottom: 4),
596598
child: SBUTextComponent(
@@ -611,6 +613,7 @@ class SBUMessageListItemComponentState
611613
widget.unfocus();
612614
await showModalBottomSheet(
613615
context: context,
616+
isScrollControlled: true,
614617
shape: const RoundedRectangleBorder(
615618
borderRadius: BorderRadius.only(
616619
topLeft: Radius.circular(8),
@@ -798,6 +801,7 @@ class SBUMessageListItemComponentState
798801
widget.unfocus();
799802
await showModalBottomSheet(
800803
context: context,
804+
isScrollControlled: true,
801805
shape: const RoundedRectangleBorder(
802806
borderRadius: BorderRadius.only(
803807
topLeft: Radius.circular(8),
@@ -882,6 +886,7 @@ class SBUMessageListItemComponentState
882886
widget.unfocus();
883887
await showModalBottomSheet(
884888
context: context,
889+
isScrollControlled: true,
885890
shape: const RoundedRectangleBorder(
886891
borderRadius: BorderRadius.only(
887892
topLeft: Radius.circular(8),
@@ -1012,6 +1017,7 @@ class SBUMessageListItemComponentState
10121017
widget.unfocus();
10131018
await showModalBottomSheet(
10141019
context: context,
1020+
isScrollControlled: true,
10151021
shape: const RoundedRectangleBorder(
10161022
borderRadius: BorderRadius.only(
10171023
topLeft: Radius.circular(8),
@@ -1043,7 +1049,7 @@ class SBUMessageListItemComponentState
10431049
children: [
10441050
if (isSameMinuteAtPreviousMessage == false)
10451051
if (message.isReplyToChannel == false &&
1046-
message.parentMessage == null)
1052+
message.parentMessageId == null)
10471053
Padding(
10481054
padding: const EdgeInsets.only(left: 12, bottom: 4),
10491055
child: SBUTextComponent(
@@ -1068,6 +1074,7 @@ class SBUMessageListItemComponentState
10681074
widget.unfocus();
10691075
await showModalBottomSheet(
10701076
context: context,
1077+
isScrollControlled: true,
10711078
shape: const RoundedRectangleBorder(
10721079
borderRadius: BorderRadius.only(
10731080
topLeft: Radius.circular(8),
@@ -1266,6 +1273,7 @@ class SBUMessageListItemComponentState
12661273
widget.unfocus();
12671274
await showModalBottomSheet(
12681275
context: context,
1276+
isScrollControlled: true,
12691277
shape: const RoundedRectangleBorder(
12701278
borderRadius: BorderRadius.only(
12711279
topLeft: Radius.circular(8),
@@ -1360,6 +1368,7 @@ class SBUMessageListItemComponentState
13601368
widget.unfocus();
13611369
await showModalBottomSheet(
13621370
context: context,
1371+
isScrollControlled: true,
13631372
shape: const RoundedRectangleBorder(
13641373
borderRadius: BorderRadius.only(
13651374
topLeft: Radius.circular(8),
@@ -1478,10 +1487,6 @@ class SBUMessageListItemComponentState
14781487
child: child,
14791488
);
14801489

1481-
if (widget.isReplyMessage(message)) {
1482-
result = Container(); // Check
1483-
}
1484-
14851490
return result;
14861491
}
14871492

@@ -1633,9 +1638,18 @@ class SBUMessageListItemComponentState
16331638
Widget result = child;
16341639

16351640
if (widget.isReplyMessageToChannel(message)) {
1641+
BaseMessage parentMessage = message.parentMessage!;
1642+
if (message.parentMessageId != null) {
1643+
final updatableMessage = collection.messageList
1644+
.firstWhereOrNull((m) => m.messageId == message.parentMessageId);
1645+
if (updatableMessage != null) {
1646+
parentMessage = updatableMessage;
1647+
}
1648+
}
1649+
16361650
Widget parentMessageItemWidget = _parentMessageItemWidget(
16371651
collection: collection,
1638-
message: message.parentMessage!,
1652+
message: parentMessage,
16391653
isSameMinuteAtPreviousMessage: isSameMinuteAtPreviousMessage,
16401654
isSameMinuteAtNextMessage: isSameMinuteAtNextMessage,
16411655
timeString: timeString,
@@ -1683,8 +1697,6 @@ class SBUMessageListItemComponentState
16831697
),
16841698
],
16851699
);
1686-
} else if (widget.isReplyMessage(message)) {
1687-
result = Container(); // Check
16881700
}
16891701

16901702
return result;

lib/src/internal/provider/sbu_message_collection_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SBUMessageCollectionProvider with ChangeNotifier {
3232
if (params != null && params.replyType != null) {
3333
replyType = params.replyType;
3434
} else if (SBUReplyManager().isQuoteReplyAvailable(channel)) {
35-
replyType = ReplyType.all;
35+
replyType = ReplyType.onlyReplyToChannel;
3636
}
3737

3838
final collection = MessageCollection(

0 commit comments

Comments
 (0)