Skip to content

Commit ca92ee0

Browse files
esarbanisd3xvn
andauthored
docs(ui): document reaction icon customization (#1896)
* doc(ui): document reaction icon customization * chore: fix linting * Update docusaurus/docs/Flutter/02-stream_chat_flutter/03-custom_widgets/01-customize_message_widget.mdx Co-authored-by: Deven Joshi <[email protected]> * chore: update code snippet --------- Co-authored-by: Deven Joshi <[email protected]>
1 parent 6c31f8a commit ca92ee0

File tree

10 files changed

+37
-5
lines changed

10 files changed

+37
-5
lines changed

docusaurus/docs/Flutter/02-stream_chat_flutter/03-custom_widgets/01-customize_message_widget.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,32 @@ StreamMessageListView(
2828
),
2929
```
3030

31+
### Providing Custom Reaction Icons
32+
33+
By default the `StreamReactionIcon` widgets provided by the SDK are `love`, `like`, `sad`, `haha`, and `wow`.
34+
However, you can provide your own custom reaction icons by providing a `reactionIcons` parameter to the `StreamChatConfigurationData`.
35+
36+
```dart
37+
StreamChat(
38+
client: client,
39+
streamChatConfigData: StreamChatConfigurationData(
40+
reactionIcons: [
41+
StreamReactionIcon(
42+
type: 'custom',
43+
builder: (context, isHighlighted, iconSize) {
44+
return Icon(
45+
Icons.star,
46+
size: iconSize,
47+
color: isHighlighted ? Colors.red : Colors.black,
48+
);
49+
},
50+
),
51+
]
52+
),
53+
child: //Your widget here
54+
)
55+
```
56+
3157
### Theming
3258

3359
You can customize the `StreamMessageWidget` using the `StreamChatTheme` class, so that you can change the

packages/stream_chat_flutter/lib/src/dialogs/confirmation_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
33

4-
/// /// {@template confirmationDialog}
4+
/// {@template confirmationDialog}
55
/// A dialog that prompts the user to take an action or cancel.
66
/// {@endtemplate}
77
class ConfirmationDialog extends StatelessWidget {

packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/src/theme/themes.dart';
77
import 'package:stream_chat_flutter/src/utils/utils.dart';
88
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
99

10-
/// {@macro streamGalleryHeader}
10+
/// {@template streamGalleryHeader}
1111
/// Header/AppBar widget for media display screen
1212
/// {@endtemplate}
1313
class StreamGalleryHeader extends StatelessWidget

packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ class BottomRow extends StatelessWidget {
263263
// textScaleFactor is already applied to the textSpan.
264264
//
265265
// issue: https://github.com/GetStream/stream-chat-flutter/issues/1250
266+
// ignore: deprecated_member_use
266267
data: mediaQueryData.copyWith(textScaleFactor: 1),
267268
child: child,
268269
),

packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class StreamMessageWidget extends StatefulWidget {
339339
/// with the tap action on the reactions picker.
340340
final OnReactionsTap? onReactionsTap;
341341

342-
/// {@template onReactionsHover}
342+
/// {@macro onReactionsHover}
343343
///
344344
/// Note: Only used in desktop devices (web and desktop).
345345
final OnReactionsHover? onReactionsHover;

packages/stream_chat_flutter/lib/src/scroll_view/photo_gallery/stream_photo_gallery_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class MediaThumbnailProvider extends ImageProvider<MediaThumbnailProvider> {
234234
}
235235

236236
@override
237-
bool operator ==(dynamic other) {
237+
bool operator ==(Object other) {
238238
if (other is MediaThumbnailProvider) {
239239
return media == other.media &&
240240
size == other.size &&

packages/stream_chat_flutter/lib/src/stream_chat.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class StreamChatState extends State<StreamChat> {
114114
final theme = _getTheme(context, widget.streamChatThemeData);
115115
return Theme(
116116
data: Theme.of(context).copyWith(
117+
// ignore: deprecated_member_use
117118
useMaterial3: widget.useMaterial3,
118119
),
119120
child: Portal(

packages/stream_chat_flutter/lib/src/theme/stream_chat_theme.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class StreamChatThemeData {
5050
Widget Function(BuildContext, User)? defaultUserImage,
5151
PlaceholderUserImage? placeholderUserImage,
5252
IconThemeData? primaryIconTheme,
53+
@Deprecated('Use StreamChatConfigurationData.reactionIcons instead')
5354
List<StreamReactionIcon>? reactionIcons,
5455
StreamGalleryHeaderThemeData? imageHeaderTheme,
5556
StreamGalleryFooterThemeData? imageFooterTheme,
@@ -75,6 +76,7 @@ class StreamChatThemeData {
7576
defaultUserImage: defaultUserImage,
7677
placeholderUserImage: placeholderUserImage,
7778
primaryIconTheme: primaryIconTheme,
79+
//ignore: deprecated_member_use_from_same_package
7880
reactionIcons: reactionIcons,
7981
galleryHeaderTheme: imageHeaderTheme,
8082
galleryFooterTheme: imageFooterTheme,
@@ -330,6 +332,7 @@ class StreamChatThemeData {
330332
PlaceholderUserImage? placeholderUserImage,
331333
IconThemeData? primaryIconTheme,
332334
StreamChannelListHeaderThemeData? channelListHeaderTheme,
335+
@Deprecated('Use StreamChatConfigurationData.reactionIcons instead')
333336
List<StreamReactionIcon>? reactionIcons,
334337
StreamGalleryHeaderThemeData? galleryHeaderTheme,
335338
StreamGalleryFooterThemeData? galleryFooterTheme,

packages/stream_chat_flutter/lib/src/utils/extensions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ extension InputDecorationX on InputDecoration {
230230
extension BuildContextX on BuildContext {
231231
// ignore: public_member_api_docs
232232
double get textScaleFactor =>
233+
// ignore: deprecated_member_use
233234
MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0;
234235

235236
/// Retrieves current translations according to locale

packages/stream_chat_flutter/lib/src/utils/typedefs.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ typedef AttachmentThumbnailBuilder = Widget Function(
136136
Attachment,
137137
);
138138

139-
/// {@macro mentionTileBuilder}
139+
/// {@template mentionTileBuilder}
140140
/// A widget builder for representing a custom mention tile.
141141
/// {@endtemplate}
142142
typedef MentionTileBuilder = Widget Function(

0 commit comments

Comments
 (0)