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

docs(ui): document reaction icon customization #1896

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ StreamMessageListView(
),
```

### Providing Custom Reaction Icons

By default the `StreamReactionIcon` widgets provided by the SDK are `love`, `like`, `sad`, `haha`, and `wow`.
Howerver, you can provide your own custom reaction icons by providing a `reactionIcons` parameter to the `StreamChatConfigurationData`.
esarbanis marked this conversation as resolved.
Show resolved Hide resolved

```dart
class MyApp extends StatelessWidget {
const MyApp({
required this.client,
});
final StreamChatClient client;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Container(
child: StreamChat(
client: client,
streamChatConfigData: StreamChatConfigurationData(
reactionIcons: [
StreamReactionIcon(
type: 'custom',
builder: (context, isHighlighted, iconSize) {
return Icon(
Icons.star,
size: iconSize,
color: isHighlighted ? Colors.red : Colors.black,
);
},
),
]
),
esarbanis marked this conversation as resolved.
Show resolved Hide resolved
child: ChannelListPage(),
),
),
);
}
}
```

### Theming

You can customize the `StreamMessageWidget` using the `StreamChatTheme` class, so that you can change the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';

/// /// {@template confirmationDialog}
/// {@template confirmationDialog}
/// A dialog that prompts the user to take an action or cancel.
/// {@endtemplate}
class ConfirmationDialog extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:stream_chat_flutter/src/theme/themes.dart';
import 'package:stream_chat_flutter/src/utils/utils.dart';
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';

/// {@macro streamGalleryHeader}
/// {@template streamGalleryHeader}
/// Header/AppBar widget for media display screen
/// {@endtemplate}
class StreamGalleryHeader extends StatelessWidget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class BottomRow extends StatelessWidget {
// textScaleFactor is already applied to the textSpan.
//
// issue: https://github.com/GetStream/stream-chat-flutter/issues/1250
// ignore: deprecated_member_use
data: mediaQueryData.copyWith(textScaleFactor: 1),
child: child,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class StreamMessageWidget extends StatefulWidget {
/// with the tap action on the reactions picker.
final OnReactionsTap? onReactionsTap;

/// {@template onReactionsHover}
/// {@macro onReactionsHover}
///
/// Note: Only used in desktop devices (web and desktop).
final OnReactionsHover? onReactionsHover;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class MediaThumbnailProvider extends ImageProvider<MediaThumbnailProvider> {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
if (other is MediaThumbnailProvider) {
return media == other.media &&
size == other.size &&
Expand Down
1 change: 1 addition & 0 deletions packages/stream_chat_flutter/lib/src/stream_chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class StreamChatState extends State<StreamChat> {
final theme = _getTheme(context, widget.streamChatThemeData);
return Theme(
data: Theme.of(context).copyWith(
// ignore: deprecated_member_use
useMaterial3: widget.useMaterial3,
),
child: Portal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class StreamChatThemeData {
Widget Function(BuildContext, User)? defaultUserImage,
PlaceholderUserImage? placeholderUserImage,
IconThemeData? primaryIconTheme,
@Deprecated('Use StreamChatConfigurationData.reactionIcons instead')
List<StreamReactionIcon>? reactionIcons,
StreamGalleryHeaderThemeData? imageHeaderTheme,
StreamGalleryFooterThemeData? imageFooterTheme,
Expand All @@ -75,6 +76,7 @@ class StreamChatThemeData {
defaultUserImage: defaultUserImage,
placeholderUserImage: placeholderUserImage,
primaryIconTheme: primaryIconTheme,
//ignore: deprecated_member_use_from_same_package
reactionIcons: reactionIcons,
galleryHeaderTheme: imageHeaderTheme,
galleryFooterTheme: imageFooterTheme,
Expand Down Expand Up @@ -330,6 +332,7 @@ class StreamChatThemeData {
PlaceholderUserImage? placeholderUserImage,
IconThemeData? primaryIconTheme,
StreamChannelListHeaderThemeData? channelListHeaderTheme,
@Deprecated('Use StreamChatConfigurationData.reactionIcons instead')
List<StreamReactionIcon>? reactionIcons,
StreamGalleryHeaderThemeData? galleryHeaderTheme,
StreamGalleryFooterThemeData? galleryFooterTheme,
Expand Down
1 change: 1 addition & 0 deletions packages/stream_chat_flutter/lib/src/utils/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ extension InputDecorationX on InputDecoration {
extension BuildContextX on BuildContext {
// ignore: public_member_api_docs
double get textScaleFactor =>
// ignore: deprecated_member_use
MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0;

/// Retrieves current translations according to locale
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat_flutter/lib/src/utils/typedefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ typedef AttachmentThumbnailBuilder = Widget Function(
Attachment,
);

/// {@macro mentionTileBuilder}
/// {@template mentionTileBuilder}
/// A widget builder for representing a custom mention tile.
/// {@endtemplate}
typedef MentionTileBuilder = Widget Function(
Expand Down
Loading