Minor ui fixes

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2020-12-30 12:45:16 +05:30
parent 9c53a295ae
commit 27578c7a0a
4 changed files with 82 additions and 40 deletions
+32 -1
View File
@@ -381,12 +381,43 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
}, },
), ),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.data == null) { if (!snapshot.hasData) {
return Center( return Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); );
} }
if (snapshot.data.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
StreamSvgIcon.message(
size: 136.0,
color: Color(0xffdbdbdb),
),
SizedBox(height: 16.0),
Text(
'No Shared Groups',
style: TextStyle(
fontSize: 14.0,
color: Color(0xff000000),
),
),
SizedBox(height: 8.0),
Text(
'Group shared with User will appear here.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0,
color: Color(0xff000000).withOpacity(0.5),
),
),
],
),
);
}
return ListView.builder( return ListView.builder(
itemCount: snapshot.data.length, itemCount: snapshot.data.length,
itemBuilder: (context, position) { itemBuilder: (context, position) {
+24 -22
View File
@@ -671,32 +671,34 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}), }),
_buildModalListTile( _buildModalListTile(
StreamSvgIcon.message( StreamSvgIcon.message(
color: Color(0xff7a7a7a), color: Color(0xff7a7a7a),
size: 24.0, size: 24.0,
), ),
'Message', () async { 'Message',
var client = StreamChat.of(context).client; () async {
var client = StreamChat.of(context).client;
var c = client.channel('messaging', extraData: { var c = client.channel('messaging', extraData: {
'members': [ 'members': [
user.id, user.id,
StreamChat.of(context).user.id, StreamChat.of(context).user.id,
], ],
}); });
await c.watch(); await c.watch();
await Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
channel: c, channel: c,
child: ChannelPage(), child: ChannelPage(),
),
), ),
), );
); },
}), ),
if (!channel.isDistinct && if (!channel.isDistinct &&
StreamChat.of(context).user.id != user.id && StreamChat.of(context).user.id != user.id &&
isUserAdmin) isUserAdmin)
+12 -9
View File
@@ -15,9 +15,13 @@ class ChannelFileDisplayScreen extends StatefulWidget {
/// message_limit: how many messages should be included to each channel /// message_limit: how many messages should be included to each channel
final PaginationParams paginationParams; final PaginationParams paginationParams;
ChannelFileDisplayScreen({ /// The builder used when the file list is empty.
final WidgetBuilder emptyBuilder;
const ChannelFileDisplayScreen({
this.sortOptions, this.sortOptions,
this.paginationParams, this.paginationParams,
this.emptyBuilder,
}); });
@override @override
@@ -93,6 +97,9 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
} }
if (snapshot.data.isEmpty) { if (snapshot.data.isEmpty) {
if (widget.emptyBuilder != null) {
return widget.emptyBuilder(context);
}
return Center( return Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -101,19 +108,15 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
size: 136.0, size: 136.0,
color: Color(0xffdbdbdb), color: Color(0xffdbdbdb),
), ),
SizedBox( SizedBox(height: 16.0),
height: 16.0,
),
Text( Text(
'No Media', 'No Files',
style: TextStyle( style: TextStyle(
fontSize: 14.0, fontSize: 14.0,
color: Color(0xff000000), color: Color(0xff000000),
), ),
), ),
SizedBox( SizedBox(height: 8.0),
height: 8.0,
),
Text( Text(
'Files sent in this chat will appear here', 'Files sent in this chat will appear here',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@@ -127,7 +130,7 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
); );
} }
Map<Attachment, Message> media = {}; final media = <Attachment, Message>{};
for (var item in snapshot.data) { for (var item in snapshot.data) {
item.message.attachments.where((e) => e.type == 'file').forEach((e) { item.message.attachments.where((e) => e.type == 'file').forEach((e) {
+14 -8
View File
@@ -17,7 +17,14 @@ class ChannelMediaDisplayScreen extends StatefulWidget {
/// message_limit: how many messages should be included to each channel /// message_limit: how many messages should be included to each channel
final PaginationParams paginationParams; final PaginationParams paginationParams;
ChannelMediaDisplayScreen({this.sortOptions, this.paginationParams}); /// The builder used when the file list is empty.
final WidgetBuilder emptyBuilder;
const ChannelMediaDisplayScreen({
this.sortOptions,
this.paginationParams,
this.emptyBuilder,
});
@override @override
_ChannelMediaDisplayScreenState createState() => _ChannelMediaDisplayScreenState createState() =>
@@ -92,6 +99,9 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
} }
if (snapshot.data.isEmpty) { if (snapshot.data.isEmpty) {
if (widget.emptyBuilder != null) {
return widget.emptyBuilder(context);
}
return Center( return Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -100,9 +110,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
size: 136.0, size: 136.0,
color: Color(0xffdbdbdb), color: Color(0xffdbdbdb),
), ),
SizedBox( SizedBox(height: 16.0),
height: 16.0,
),
Text( Text(
'No Media', 'No Media',
style: TextStyle( style: TextStyle(
@@ -110,9 +118,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
color: Color(0xff000000), color: Color(0xff000000),
), ),
), ),
SizedBox( SizedBox(height: 8.0),
height: 8.0,
),
Text( Text(
'Photos or video sent in this chat will \nappear here', 'Photos or video sent in this chat will \nappear here',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@@ -126,7 +132,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
); );
} }
List<_AssetPackage> media = []; final media = <_AssetPackage>[];
for (var item in snapshot.data) { for (var item in snapshot.data) {
item.message.attachments item.message.attachments