From 16ed0c5bb46541877d624298e82ae176a1947ffc Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Fri, 4 Dec 2020 16:29:43 +0530 Subject: [PATCH 01/11] feat: Added chat info page --- lib/src/channel_header.dart | 23 ++- lib/src/chat_info_screen.dart | 319 +++++++++++++++++++++++++++++++++ lib/src/stream_svg_icon.dart | 36 ++++ lib/svgs/Icon_group.svg | 3 + lib/svgs/Icon_notification.svg | 6 + 5 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 lib/src/chat_info_screen.dart create mode 100644 lib/svgs/Icon_group.svg create mode 100644 lib/svgs/Icon_notification.svg diff --git a/lib/src/channel_header.dart b/lib/src/channel_header.dart index ebaaf20f..09833ad3 100644 --- a/lib/src/channel_header.dart +++ b/lib/src/channel_header.dart @@ -5,8 +5,10 @@ import 'package:stream_chat_flutter/src/channel_info.dart'; import 'package:stream_chat_flutter/src/channel_name.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; +import '../stream_chat_flutter.dart'; import './channel_name.dart'; import 'channel_image.dart'; +import 'chat_info_screen.dart'; import 'stream_channel.dart'; /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_header.png) @@ -97,7 +99,26 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget { padding: const EdgeInsets.only(right: 10.0), child: Center( child: ChannelImage( - onTap: onImageTap, + onTap: onImageTap ?? + () { + var currentUser = StreamChat.of(context).user; + var otherUser = channel.state.members.firstWhere( + (element) => element.user.id != currentUser.id); + + if (channel.memberCount == 2) { + if (otherUser != null) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StreamChannel( + channel: channel, + child: ChatInfoScreen( + user: otherUser.user, + ), + ))); + } + } + }, ), ), ), diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart new file mode 100644 index 00000000..18efdc1b --- /dev/null +++ b/lib/src/chat_info_screen.dart @@ -0,0 +1,319 @@ +import 'package:emojis/emojis.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../stream_chat_flutter.dart'; + +/// Detail screen for a 1:1 chat correspondence +class ChatInfoScreen extends StatefulWidget { + /// User in consideration + final User user; + + const ChatInfoScreen({Key key, this.user}) : super(key: key); + + @override + _ChatInfoScreenState createState() => _ChatInfoScreenState(); +} + +class _ChatInfoScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xFFe6e6e6), + body: ListView( + children: [ + _buildUserHeader(), + SizedBox( + height: 8.0, + ), + _buildOptionListTiles(), + SizedBox( + height: 8.0, + ), + _buildDeleteListTile(), + ], + ), + ); + } + + Widget _buildUserHeader() { + return Material( + color: Colors.white, + child: SafeArea( + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: UserAvatar( + user: widget.user, + constraints: BoxConstraints( + maxWidth: 72.0, + maxHeight: 72.0, + ), + borderRadius: BorderRadius.circular(36.0), + ), + ), + SizedBox(height: 15.0), + Text( + widget.user.name, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox(height: 7.0), + Text('Online for 5 minutes'), + SizedBox(height: 15.0), + _OptionListTile( + title: '@user', + trailing: Text(widget.user.name), + onTap: () {}, + ), + ], + ), + Positioned( + top: 21, + left: 16, + child: InkWell( + child: StreamSvgIcon.left(), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ), + ], + ), + ), + ); + } + + Widget _buildOptionListTiles() { + var channel = StreamChannel.of(context); + + return Column( + children: [ + _OptionListTile( + title: 'Notifications', + leading: StreamSvgIcon.Icon_notification( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: CupertinoSwitch( + value: true, + onChanged: (val) {}, + ), + onTap: () {}, + ), + StreamBuilder( + stream: StreamChannel.of(context).channel.isMutedStream, + builder: (context, snapshot) { + return _OptionListTile( + title: 'Mute user', + leading: StreamSvgIcon.mute( + size: 23.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: snapshot.data == null + ? CircularProgressIndicator() + : CupertinoSwitch( + value: snapshot.data, + onChanged: (val) { + if (snapshot.data) { + channel.channel.unmute(); + } else { + channel.channel.mute(); + } + }, + ), + onTap: () {}, + ); + }), + _OptionListTile( + title: 'Block User', + leading: StreamSvgIcon.Icon_user_delete( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: CupertinoSwitch( + value: true, + onChanged: (val) {}, + ), + onTap: () {}, + ), + _OptionListTile( + title: '615 Photos & Videos', + leading: StreamSvgIcon.pictures( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: StreamSvgIcon.right(), + onTap: () {}, + ), + _OptionListTile( + title: '8 Files', + leading: StreamSvgIcon.files( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: StreamSvgIcon.right(), + onTap: () {}, + ), + _OptionListTile( + title: '2 Shared groups', + leading: StreamSvgIcon.Icon_group( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: StreamSvgIcon.right(), + onTap: () {}, + ), + ], + ); + } + + Widget _buildDeleteListTile() { + return _OptionListTile( + title: 'Delete', + leading: StreamSvgIcon.delete( + color: Colors.red, + size: 20.0, + ), + onTap: () { + _showDeleteDialog(); + }, + titleColor: Colors.red, + ); + } + + void _showDeleteDialog() { + var channel = StreamChannel.of(context).channel; + + showModalBottomSheet( + backgroundColor: Colors.white, + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(16.0), + topRight: Radius.circular(16.0), + )), + builder: (context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 26.0, + ), + StreamSvgIcon.delete( + color: Colors.red, + ), + SizedBox( + height: 26.0, + ), + Text( + 'Delete Conversation', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0), + ), + SizedBox( + height: 7.0, + ), + Text('Are you sure you want to delete this conversation?'), + SizedBox( + height: 36.0, + ), + Container( + color: Color(0xffe6e6e6), + height: 1.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FlatButton( + child: Text( + 'CANCEL', + style: TextStyle( + color: Colors.black.withOpacity(0.5), + fontWeight: FontWeight.w400), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + FlatButton( + child: Text( + 'DELETE', + style: TextStyle( + color: Colors.red, fontWeight: FontWeight.w400), + ), + onPressed: () { + channel.delete().then((value) { + Navigator.pop(context); + Navigator.pop(context); + Navigator.pop(context); + }); + }, + ), + ], + ), + ], + ); + }); + } +} + +class _OptionListTile extends StatelessWidget { + final String title; + final StreamSvgIcon leading; + final Widget trailing; + final VoidCallback onTap; + final Color titleColor; + + _OptionListTile({ + this.title, + this.leading, + this.trailing, + this.onTap, + this.titleColor, + }); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + color: Color(0xffe6e6e6), + height: 2.0, + ), + Material( + color: Colors.white, + child: InkWell( + onTap: onTap, + child: Row( + children: [ + if (leading != null) + Padding( + padding: const EdgeInsets.all(22.0), + child: leading, + ), + if (leading == null) + SizedBox( + width: 16.0, + ), + Expanded( + child: Text( + title, + style: + TextStyle(fontWeight: FontWeight.w600, color: titleColor), + )), + if (trailing != null) + Padding( + padding: const EdgeInsets.all(16.0), + child: trailing, + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/src/stream_svg_icon.dart b/lib/src/stream_svg_icon.dart index 42fed46e..98ce0f8e 100644 --- a/lib/src/stream_svg_icon.dart +++ b/lib/src/stream_svg_icon.dart @@ -721,4 +721,40 @@ class StreamSvgIcon extends StatelessWidget { height: size, ); } + + factory StreamSvgIcon.Icon_group({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_group.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.Icon_notification({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_notification.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.Icon_user_delete({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_user_delete.svg', + color: color, + width: size, + height: size, + ); + } } diff --git a/lib/svgs/Icon_group.svg b/lib/svgs/Icon_group.svg new file mode 100644 index 00000000..6db40129 --- /dev/null +++ b/lib/svgs/Icon_group.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/svgs/Icon_notification.svg b/lib/svgs/Icon_notification.svg new file mode 100644 index 00000000..213f33c0 --- /dev/null +++ b/lib/svgs/Icon_notification.svg @@ -0,0 +1,6 @@ + + + + + + From 75262dbd4995a28e37940dfa8ed4ef6b223f5c50 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 7 Dec 2020 20:30:54 +0530 Subject: [PATCH 02/11] feat: Added shared groups, removed notifications, fixed listtile --- lib/src/chat_info_screen.dart | 185 +++++++++++++++++++++++++--------- 1 file changed, 138 insertions(+), 47 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 18efdc1b..8310d1b9 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -92,18 +92,18 @@ class _ChatInfoScreenState extends State { return Column( children: [ - _OptionListTile( - title: 'Notifications', - leading: StreamSvgIcon.Icon_notification( - size: 24.0, - color: Colors.black.withOpacity(0.5), - ), - trailing: CupertinoSwitch( - value: true, - onChanged: (val) {}, - ), - onTap: () {}, - ), + // _OptionListTile( + // title: 'Notifications', + // leading: StreamSvgIcon.Icon_notification( + // size: 24.0, + // color: Colors.black.withOpacity(0.5), + // ), + // trailing: CupertinoSwitch( + // value: true, + // onChanged: (val) {}, + // ), + // onTap: () {}, + // ), StreamBuilder( stream: StreamChannel.of(context).channel.isMutedStream, builder: (context, snapshot) { @@ -143,7 +143,7 @@ class _ChatInfoScreenState extends State { _OptionListTile( title: '615 Photos & Videos', leading: StreamSvgIcon.pictures( - size: 24.0, + size: 32.0, color: Colors.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), @@ -152,21 +152,36 @@ class _ChatInfoScreenState extends State { _OptionListTile( title: '8 Files', leading: StreamSvgIcon.files( - size: 24.0, - color: Colors.black.withOpacity(0.5), - ), - trailing: StreamSvgIcon.right(), - onTap: () {}, - ), - _OptionListTile( - title: '2 Shared groups', - leading: StreamSvgIcon.Icon_group( - size: 24.0, + size: 32.0, color: Colors.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), onTap: () {}, ), + StreamBuilder>( + stream: StreamChat.of(context).client.queryChannels( + filter: { + 'members': [StreamChat.of(context).user.id, widget.user.id], + }, + ), + builder: (context, snapshot) { + return _OptionListTile( + title: + '${snapshot.data == null ? '0' : snapshot.data.length} Shared groups', + leading: StreamSvgIcon.Icon_group( + size: 24.0, + color: Colors.black.withOpacity(0.5), + ), + trailing: StreamSvgIcon.right(), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => _SharedGroupsScreen( + StreamChat.of(context).user, widget.user))); + }, + ); + }), ], ); } @@ -285,31 +300,34 @@ class _OptionListTile extends StatelessWidget { ), Material( color: Colors.white, - child: InkWell( - onTap: onTap, - child: Row( - children: [ - if (leading != null) - Padding( - padding: const EdgeInsets.all(22.0), - child: leading, + child: Container( + height: 56.0, + child: InkWell( + onTap: onTap, + child: Row( + children: [ + if (leading != null) + Expanded( + child: Center(child: leading), + ), + if (leading == null) + SizedBox( + width: 16.0, + ), + Expanded( + flex: 4, + child: Text( + title, + style: TextStyle( + fontWeight: FontWeight.w600, color: titleColor), + )), + Expanded( + child: Center( + child: trailing ?? Container(), + ), ), - if (leading == null) - SizedBox( - width: 16.0, - ), - Expanded( - child: Text( - title, - style: - TextStyle(fontWeight: FontWeight.w600, color: titleColor), - )), - if (trailing != null) - Padding( - padding: const EdgeInsets.all(16.0), - child: trailing, - ), - ], + ], + ), ), ), ), @@ -317,3 +335,76 @@ class _OptionListTile extends StatelessWidget { ); } } + +class _SharedGroupsScreen extends StatefulWidget { + final User mainUser; + final User otherUser; + + _SharedGroupsScreen(this.mainUser, this.otherUser); + + @override + __SharedGroupsScreenState createState() => __SharedGroupsScreenState(); +} + +class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { + @override + Widget build(BuildContext context) { + var chat = StreamChat.of(context); + + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + brightness: Theme.of(context).brightness, + elevation: 1, + centerTitle: true, + title: Text( + 'Shared Groups', + style: TextStyle(color: Colors.black, fontSize: 16.0), + ), + leading: Center( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + child: StreamSvgIcon.left( + color: Colors.black, + size: 24.0, + ), + width: 24.0, + height: 24.0, + ), + ), + ), + backgroundColor: StreamChatTheme.of(context).primaryColor, + ), + body: StreamBuilder>( + stream: chat.client.queryChannels( + filter: { + 'members': [widget.mainUser.id, widget.otherUser.id], + }, + ), + builder: (context, snapshot) { + if (snapshot.data == null) { + return Center( + child: CircularProgressIndicator(), + ); + } + + return ListView.builder( + itemCount: snapshot.data.length, + itemBuilder: (context, position) { + return StreamChannel( + channel: snapshot.data[position], + child: ChannelPreview( + channel: snapshot.data[position], + onTap: (val) {}, + ), + ); + }, + ); + }, + ), + ); + } +} From c6a97751316bdebcc05f1a6c19535a3aa0315c8d Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Tue, 8 Dec 2020 20:00:30 +0530 Subject: [PATCH 03/11] feat: Added dummy pages for files and media --- lib/src/chat_info_screen.dart | 78 ++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 8310d1b9..92ee4446 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -147,7 +147,10 @@ class _ChatInfoScreenState extends State { color: Colors.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), - onTap: () {}, + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => _MediaDisplayScreen())); + }, ), _OptionListTile( title: '8 Files', @@ -156,7 +159,10 @@ class _ChatInfoScreenState extends State { color: Colors.black.withOpacity(0.5), ), trailing: StreamSvgIcon.right(), - onTap: () {}, + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => _FileDisplayScreen())); + }, ), StreamBuilder>( stream: StreamChat.of(context).client.queryChannels( @@ -408,3 +414,71 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { ); } } + +class _MediaDisplayScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + brightness: Theme.of(context).brightness, + elevation: 1, + centerTitle: true, + title: Text( + 'Photos & Videos', + style: TextStyle(color: Colors.black, fontSize: 16.0), + ), + leading: Center( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + child: StreamSvgIcon.left( + color: Colors.black, + size: 24.0, + ), + width: 24.0, + height: 24.0, + ), + ), + ), + backgroundColor: StreamChatTheme.of(context).primaryColor, + ), + ); + } +} + +class _FileDisplayScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + brightness: Theme.of(context).brightness, + elevation: 1, + centerTitle: true, + title: Text( + 'Files', + style: TextStyle(color: Colors.black, fontSize: 16.0), + ), + leading: Center( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + child: StreamSvgIcon.left( + color: Colors.black, + size: 24.0, + ), + width: 24.0, + height: 24.0, + ), + ), + ), + backgroundColor: StreamChatTheme.of(context).primaryColor, + ), + ); + } +} From 5cef917e511538342e855e0d22d1a4d2f4d79077 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 9 Dec 2020 13:35:28 +0530 Subject: [PATCH 04/11] feat: Added implementation for last seen --- lib/src/chat_info_screen.dart | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 92ee4446..9ef80c9e 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -1,6 +1,7 @@ import 'package:emojis/emojis.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; import '../stream_chat_flutter.dart'; @@ -62,7 +63,7 @@ class _ChatInfoScreenState extends State { style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), ), SizedBox(height: 7.0), - Text('Online for 5 minutes'), + _buildConnectedTitleState(), SizedBox(height: 15.0), _OptionListTile( title: '@user', @@ -279,6 +280,31 @@ class _ChatInfoScreenState extends State { ); }); } + + Widget _buildConnectedTitleState() { + var alternativeWidget; + + final otherMember = widget.user; + + if (otherMember != null) { + if (otherMember.online) { + alternativeWidget = Text( + 'Online', + style: StreamChatTheme.of(context) + .channelTheme + .channelHeaderTheme + .lastMessageAt, + ); + } else { + alternativeWidget = Text( + 'Last seen ${Jiffy(otherMember.lastActive).fromNow()}', + //style: textStyle, + ); + } + } + + return alternativeWidget; + } } class _OptionListTile extends StatelessWidget { From aa09fd380ef08eebe48986dd920121e9fb8e856f Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 9 Dec 2020 16:56:26 +0530 Subject: [PATCH 05/11] fix: UI fixes --- lib/src/chat_info_screen.dart | 95 +++++++++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 11 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 9ef80c9e..cbda9d9b 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -67,7 +67,11 @@ class _ChatInfoScreenState extends State { SizedBox(height: 15.0), _OptionListTile( title: '@user', - trailing: Text(widget.user.name), + trailing: Text( + widget.user.name, + style: TextStyle( + color: Colors.black.withOpacity(0.5), fontSize: 16.0), + ), onTap: () {}, ), ], @@ -198,7 +202,7 @@ class _ChatInfoScreenState extends State { title: 'Delete', leading: StreamSvgIcon.delete( color: Colors.red, - size: 20.0, + size: 24.0, ), onTap: () { _showDeleteDialog(); @@ -290,15 +294,12 @@ class _ChatInfoScreenState extends State { if (otherMember.online) { alternativeWidget = Text( 'Online', - style: StreamChatTheme.of(context) - .channelTheme - .channelHeaderTheme - .lastMessageAt, + style: TextStyle(color: Colors.black.withOpacity(0.5)), ); } else { alternativeWidget = Text( 'Last seen ${Jiffy(otherMember.lastActive).fromNow()}', - //style: textStyle, + style: TextStyle(color: Colors.black.withOpacity(0.5)), ); } } @@ -428,10 +429,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { itemBuilder: (context, position) { return StreamChannel( channel: snapshot.data[position], - child: ChannelPreview( - channel: snapshot.data[position], - onTap: (val) {}, - ), + child: _buildListTile(snapshot.data[position]), ); }, ); @@ -439,6 +437,81 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { ), ); } + + Widget _buildListTile(Channel channel) { + var extraData = channel.extraData; + var members = channel.state.members; + + var textStyle = TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold); + + return Container( + height: 64.0, + child: LayoutBuilder(builder: (context, constraints) { + String title; + if (extraData['name'] == null) { + final otherMembers = members.where( + (member) => member.userId != StreamChat.of(context).user.id); + if (otherMembers.isNotEmpty) { + final maxWidth = constraints.maxWidth; + final maxChars = maxWidth / textStyle.fontSize; + var currentChars = 0; + final currentMembers = []; + otherMembers.forEach((element) { + final newLength = currentChars + element.user.name.length; + if (newLength < maxChars) { + currentChars = newLength; + currentMembers.add(element); + } + }); + + final exceedingMembers = + otherMembers.length - currentMembers.length; + title = + '${currentMembers.map((e) => e.user.name).join(', ')} ${exceedingMembers > 0 ? '+ $exceedingMembers' : ''}'; + } else { + title = 'No title'; + } + } else { + title = extraData['name']; + } + + return Column( + children: [ + Expanded( + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: ChannelImage( + channel: channel, + constraints: + BoxConstraints(maxWidth: 40.0, maxHeight: 40.0), + ), + ), + Expanded( + child: Text( + title, + style: textStyle, + )), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '${channel.memberCount} members', + style: TextStyle(color: Colors.black.withOpacity(0.5)), + ), + ) + ], + ), + ), + Container( + height: 1.0, + color: Color(0xffe6e6e6), + ), + ], + ); + }), + ); + } } class _MediaDisplayScreen extends StatelessWidget { From 9f56730409cb49063518a239019adbeae2df5c54 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 9 Dec 2020 17:13:59 +0530 Subject: [PATCH 06/11] fix: UI fixes --- lib/src/chat_info_screen.dart | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index cbda9d9b..c961b0e0 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -55,6 +55,7 @@ class _ChatInfoScreenState extends State { maxHeight: 72.0, ), borderRadius: BorderRadius.circular(36.0), + showOnlineStatus: false, ), ), SizedBox(height: 15.0), @@ -304,7 +305,28 @@ class _ChatInfoScreenState extends State { } } - return alternativeWidget; + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.user.online) + Material( + type: MaterialType.circle, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + constraints: BoxConstraints.tightFor( + width: 28, + height: 12, + ), + child: Material( + shape: CircleBorder(), + color: Color(0xff20E070), + ), + ), + color: Colors.white, + ), + alternativeWidget, + ], + ); } } From 839582d72b4b905a77d2a3570bc39322ead00869 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 9 Dec 2020 17:16:48 +0530 Subject: [PATCH 07/11] fix: UI fixes --- lib/src/chat_info_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index c961b0e0..aad1cd05 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -58,7 +58,7 @@ class _ChatInfoScreenState extends State { showOnlineStatus: false, ), ), - SizedBox(height: 15.0), + //SizedBox(height: 4.0), Text( widget.user.name, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), From 79b1401700a3d5cd2ec1090f46d3b34f1e4c93ae Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 9 Dec 2020 17:54:13 +0530 Subject: [PATCH 08/11] fix: Fixed padding --- lib/src/chat_info_screen.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index aad1cd05..3881e4a3 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -68,10 +68,13 @@ class _ChatInfoScreenState extends State { SizedBox(height: 15.0), _OptionListTile( title: '@user', - trailing: Text( - widget.user.name, - style: TextStyle( - color: Colors.black.withOpacity(0.5), fontSize: 16.0), + trailing: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Text( + widget.user.name, + style: TextStyle( + color: Colors.black.withOpacity(0.5), fontSize: 16.0), + ), ), onTap: () {}, ), From 328bc4d1bcf02b56c63706f7e19991cc424849db Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Thu, 10 Dec 2020 14:42:58 +0530 Subject: [PATCH 09/11] fix: Removed block button --- lib/src/chat_info_screen.dart | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 3881e4a3..434b0021 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -137,18 +137,24 @@ class _ChatInfoScreenState extends State { onTap: () {}, ); }), - _OptionListTile( - title: 'Block User', - leading: StreamSvgIcon.Icon_user_delete( - size: 24.0, - color: Colors.black.withOpacity(0.5), - ), - trailing: CupertinoSwitch( - value: true, - onChanged: (val) {}, - ), - onTap: () {}, - ), + // _OptionListTile( + // title: 'Block User', + // leading: StreamSvgIcon.Icon_user_delete( + // size: 24.0, + // color: Colors.black.withOpacity(0.5), + // ), + // trailing: CupertinoSwitch( + // value: widget.user.banned, + // onChanged: (val) { + // if (widget.user.banned) { + // channel.channel.shadowBan(widget.user.id, {}); + // } else { + // channel.channel.unbanUser(widget.user.id); + // } + // }, + // ), + // onTap: () {}, + // ), _OptionListTile( title: '615 Photos & Videos', leading: StreamSvgIcon.pictures( From e0e98299cae1fa51b1b88d4fb54d7e6f7d945643 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Thu, 10 Dec 2020 15:06:32 +0530 Subject: [PATCH 10/11] fix: Filter and alignment fix --- lib/src/chat_info_screen.dart | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index 434b0021..e56e812c 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -182,7 +182,18 @@ class _ChatInfoScreenState extends State { StreamBuilder>( stream: StreamChat.of(context).client.queryChannels( filter: { - 'members': [StreamChat.of(context).user.id, widget.user.id], + r'$and': [ + { + 'members': { + r'$in': [widget.user.id], + }, + }, + { + 'members': { + r'$in': [StreamChat.of(context).user.id], + }, + } + ], }, ), builder: (context, snapshot) { @@ -386,8 +397,13 @@ class _OptionListTile extends StatelessWidget { fontWeight: FontWeight.w600, color: titleColor), )), Expanded( - child: Center( - child: trailing ?? Container(), + flex: 2, + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Align( + alignment: Alignment.centerRight, + child: trailing ?? Container(), + ), ), ), ], From d97f7ecebffe821fce9edca057ad1ec368a21378 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Thu, 10 Dec 2020 15:18:14 +0530 Subject: [PATCH 11/11] fix: Filter and alignment fix --- lib/src/chat_info_screen.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/src/chat_info_screen.dart b/lib/src/chat_info_screen.dart index e56e812c..f9ee70cd 100644 --- a/lib/src/chat_info_screen.dart +++ b/lib/src/chat_info_screen.dart @@ -461,7 +461,18 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { body: StreamBuilder>( stream: chat.client.queryChannels( filter: { - 'members': [widget.mainUser.id, widget.otherUser.id], + r'$and': [ + { + 'members': { + r'$in': [widget.otherUser.id], + }, + }, + { + 'members': { + r'$in': [widget.mainUser.id], + }, + } + ], }, ), builder: (context, snapshot) {