Merge remote-tracking branch 'origin/feature/new-ui' into dj-develop-ui
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:line_awesome_icons/line_awesome_icons.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_icons.dart';
|
||||
import 'package:stream_chat_flutter/src/utils.dart';
|
||||
|
||||
import 'channel_info.dart';
|
||||
@@ -75,7 +74,7 @@ class ChannelBottomSheet extends StatelessWidget {
|
||||
builder: (context, snapshot) {
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
LineAwesomeIcons.volume_off,
|
||||
StreamIcons.mute,
|
||||
size: 22,
|
||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||
),
|
||||
@@ -95,10 +94,10 @@ class ChannelBottomSheet extends StatelessWidget {
|
||||
Divider(),
|
||||
if (channel.isGroup && !channel.isDistinct)
|
||||
ListTile(
|
||||
leading: SvgPicture.asset(
|
||||
'assets/icon_user_minus.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
width: 22,
|
||||
leading: Icon(
|
||||
StreamIcons.user_minus,
|
||||
size: 22,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: Text('Leave Group'),
|
||||
onTap: () async {
|
||||
|
||||
@@ -16,7 +16,7 @@ class ChannelInfo extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (channel.memberCount > 2) {
|
||||
if (channel.memberCount != null && channel.memberCount > 2) {
|
||||
return Text(
|
||||
'${channel.memberCount} Members, ${channel.state.watcherCount} Online',
|
||||
style: StreamChatTheme.of(context)
|
||||
|
||||
@@ -3,8 +3,6 @@ import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:line_awesome_icons/line_awesome_icons.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/channels_bloc.dart';
|
||||
import 'package:stream_chat_flutter/src/utils.dart';
|
||||
@@ -362,7 +360,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
||||
),
|
||||
IconSlideAction(
|
||||
color: backgroundColor,
|
||||
icon: LineAwesomeIcons.volume_off,
|
||||
icon: StreamIcons.mute,
|
||||
onTap: () async {
|
||||
if (!channel.isMuted) {
|
||||
await channel.mute();
|
||||
@@ -374,13 +372,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
||||
if (channel.isGroup && !channel.isDistinct)
|
||||
IconSlideAction(
|
||||
color: backgroundColor,
|
||||
iconWidget: SvgPicture.asset(
|
||||
'assets/icon_user_minus.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
color:
|
||||
StreamChatTheme.of(context).primaryIconTheme.color,
|
||||
width: 22,
|
||||
),
|
||||
icon: StreamIcons.user_minus,
|
||||
onTap: () async {
|
||||
final confirm = await showConfirmationDialog(
|
||||
context,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:line_awesome_icons/line_awesome_icons.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/unread_indicator.dart';
|
||||
|
||||
@@ -145,11 +144,11 @@ class ChannelPreview extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
LineAwesomeIcons.volume_off,
|
||||
size: 15,
|
||||
StreamIcons.mute,
|
||||
size: 16,
|
||||
),
|
||||
Text(
|
||||
'Channel is muted',
|
||||
' Channel is muted',
|
||||
style: StreamChatTheme.of(context)
|
||||
.channelPreviewTheme
|
||||
.subtitle
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/reaction_picker.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_channel.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_icons.dart';
|
||||
|
||||
import 'message_input.dart';
|
||||
import 'message_widget.dart';
|
||||
@@ -129,7 +129,7 @@ class MessageActionsModal extends StatelessWidget {
|
||||
Theme.of(context).textTheme.headline6.copyWith(color: Colors.red),
|
||||
),
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
StreamIcons.delete,
|
||||
color: Colors.red,
|
||||
),
|
||||
onTap: () {
|
||||
@@ -148,12 +148,9 @@ class MessageActionsModal extends StatelessWidget {
|
||||
'Edit message',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
leading: SvgPicture.asset(
|
||||
'assets/icon_edit.svg',
|
||||
alignment: Alignment.center,
|
||||
package: 'stream_chat_flutter',
|
||||
leading: Icon(
|
||||
StreamIcons.edit,
|
||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||
width: 24,
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
@@ -255,11 +252,11 @@ class MessageActionsModal extends StatelessWidget {
|
||||
Widget _buildReplyButton(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
'Start a thread',
|
||||
'Thread reply',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
leading: Icon(
|
||||
Icons.reply,
|
||||
StreamIcons.Thread_Reply,
|
||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||
),
|
||||
onTap: () {
|
||||
|
||||
@@ -446,7 +446,7 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
read.lastRead.isBefore(messages[index - 1].createdAt)))
|
||||
?.toList();
|
||||
|
||||
final allRead = readList.length == channel.memberCount - 1;
|
||||
final allRead = readList.length >= (channel.memberCount ?? 0) - 1;
|
||||
|
||||
return MessageWidget(
|
||||
message: message,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class ReactionAsset {
|
||||
final String type;
|
||||
final String svgAsset;
|
||||
final String package;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
ReactionAsset({
|
||||
class ReactionIcon {
|
||||
final String type;
|
||||
final IconData iconData;
|
||||
|
||||
ReactionIcon({
|
||||
this.type,
|
||||
this.svgAsset,
|
||||
this.package,
|
||||
this.iconData,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
class ReactionBubble extends StatelessWidget {
|
||||
@@ -22,7 +21,7 @@ class ReactionBubble extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final reactionAssets = StreamChatTheme.of(context).reactionAssets;
|
||||
final reactionAssets = StreamChatTheme.of(context).reactionIcons;
|
||||
return Transform(
|
||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
||||
alignment: Alignment.center,
|
||||
@@ -55,10 +54,9 @@ class ReactionBubble extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
return SvgPicture.asset(
|
||||
reactionAsset.svgAsset,
|
||||
package: reactionAsset.package,
|
||||
height: 16,
|
||||
return Icon(
|
||||
reactionAsset.iconData,
|
||||
size: 16,
|
||||
color: StreamChatTheme.of(context).accentColor,
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../stream_chat_flutter.dart';
|
||||
|
||||
@@ -23,7 +22,7 @@ class ReactionPicker extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final reactionAssets = StreamChatTheme.of(context).reactionAssets;
|
||||
final reactionAssets = StreamChatTheme.of(context).reactionIcons;
|
||||
return Material(
|
||||
color: messageTheme.ownReactionsBackgroundColor,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
@@ -34,15 +33,14 @@ class ReactionPicker extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: reactionAssets.map((reactionAsset) {
|
||||
children: reactionAssets.map((reactionIcon) {
|
||||
final ownReactionIndex = message.ownReactions?.indexWhere(
|
||||
(reaction) => reaction.type == reactionAsset.type) ??
|
||||
(reaction) => reaction.type == reactionIcon.type) ??
|
||||
-1;
|
||||
return IconButton(
|
||||
iconSize: 24,
|
||||
icon: SvgPicture.asset(
|
||||
reactionAsset.svgAsset,
|
||||
package: reactionAsset.package,
|
||||
icon: Icon(
|
||||
reactionIcon.iconData,
|
||||
color: ownReactionIndex != -1
|
||||
? StreamChatTheme.of(context).accentColor
|
||||
: Theme.of(context).iconTheme.color,
|
||||
@@ -56,7 +54,7 @@ class ReactionPicker extends StatelessWidget {
|
||||
} else {
|
||||
sendReaction(
|
||||
context,
|
||||
reactionAsset.type,
|
||||
reactionIcon.type,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:stream_chat_flutter/src/channel_header.dart';
|
||||
import 'package:stream_chat_flutter/src/channel_preview.dart';
|
||||
import 'package:stream_chat_flutter/src/message_input.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_icons.dart';
|
||||
|
||||
import 'reaction_asset.dart';
|
||||
|
||||
@@ -75,7 +76,7 @@ class StreamChatThemeData {
|
||||
final IconThemeData primaryIconTheme;
|
||||
|
||||
/// Assets used for rendering reactions
|
||||
final List<ReactionAsset> reactionAssets;
|
||||
final List<ReactionIcon> reactionIcons;
|
||||
|
||||
/// Create a theme from scratch
|
||||
StreamChatThemeData({
|
||||
@@ -90,7 +91,7 @@ class StreamChatThemeData {
|
||||
this.defaultChannelImage,
|
||||
this.defaultUserImage,
|
||||
this.primaryIconTheme,
|
||||
this.reactionAssets,
|
||||
this.reactionIcons,
|
||||
});
|
||||
|
||||
/// Create a theme from a Material [Theme]
|
||||
@@ -141,7 +142,7 @@ class StreamChatThemeData {
|
||||
Widget Function(BuildContext, Channel) defaultChannelImage,
|
||||
Widget Function(BuildContext, User) defaultUserImage,
|
||||
IconThemeData primaryIconTheme,
|
||||
List<ReactionAsset> reactionAssets,
|
||||
List<ReactionIcon> reactionAssets,
|
||||
}) =>
|
||||
StreamChatThemeData(
|
||||
primaryColor: primaryColor ?? this.primaryColor,
|
||||
@@ -210,7 +211,7 @@ class StreamChatThemeData {
|
||||
this.otherMessageTheme.avatarTheme,
|
||||
) ??
|
||||
this.otherMessageTheme,
|
||||
reactionAssets: reactionAssets ?? this.reactionAssets,
|
||||
reactionIcons: reactionAssets ?? this.reactionIcons,
|
||||
);
|
||||
|
||||
/// Get the default Stream Chat theme
|
||||
@@ -353,31 +354,26 @@ class StreamChatThemeData {
|
||||
),
|
||||
),
|
||||
),
|
||||
reactionAssets: [
|
||||
ReactionAsset(
|
||||
reactionIcons: [
|
||||
ReactionIcon(
|
||||
type: 'love',
|
||||
svgAsset: 'assets/Icon_love_reaction.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
iconData: StreamIcons.love_reaction,
|
||||
),
|
||||
ReactionAsset(
|
||||
ReactionIcon(
|
||||
type: 'thumbs_up',
|
||||
svgAsset: 'assets/Icon_thumbs_up_reaction.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
iconData: StreamIcons.thumbs_up_reaction,
|
||||
),
|
||||
ReactionAsset(
|
||||
ReactionIcon(
|
||||
type: 'thumbs_down',
|
||||
svgAsset: 'assets/Icon_thumbs_down_reaction.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
iconData: StreamIcons.thumbs_up_reaction_1,
|
||||
),
|
||||
ReactionAsset(
|
||||
ReactionIcon(
|
||||
type: 'lol',
|
||||
svgAsset: 'assets/Icon_LOL_reaction.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
iconData: StreamIcons.LOL_reaction,
|
||||
),
|
||||
ReactionAsset(
|
||||
ReactionIcon(
|
||||
type: 'wut',
|
||||
svgAsset: 'assets/Icon_wut_reaction.svg',
|
||||
package: 'stream_chat_flutter',
|
||||
iconData: StreamIcons.wut_reaction,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ export 'src/sending_indicator.dart';
|
||||
export 'src/stream_channel.dart';
|
||||
export 'src/stream_chat.dart';
|
||||
export 'src/stream_chat_theme.dart';
|
||||
export 'src/stream_icons.dart';
|
||||
export 'src/system_message.dart';
|
||||
export 'src/thread_header.dart';
|
||||
export 'src/typing_indicator.dart';
|
||||
|
||||
Reference in New Issue
Block a user