fix modal adding safearea

This commit is contained in:
Salvatore Giordano
2021-05-20 15:33:01 +02:00
parent c9e72ebc91
commit 66ea6ae875
+140 -134
View File
@@ -787,158 +787,164 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
void _showUserInfoModal(User? user, bool isUserAdmin) { void _showUserInfoModal(User? user, bool isUserAdmin) {
var channel = StreamChannel.of(context).channel; var channel = StreamChannel.of(context).channel;
final color = StreamChatTheme.of(context).colorTheme.white;
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
isScrollControlled: true, isScrollControlled: true,
backgroundColor: color,
builder: (context) { builder: (context) {
return StreamChannel( return SafeArea(
channel: channel, child: StreamChannel(
child: Material( channel: channel,
color: StreamChatTheme.of(context).colorTheme.white, child: Material(
child: Column( color: color,
mainAxisSize: MainAxisSize.min, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
SizedBox( children: [
height: 24.0, SizedBox(
), height: 24.0,
Center(
child: Text(
user!.name,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
), ),
), Center(
SizedBox( child: Text(
height: 5.0, user!.name,
), style: TextStyle(
_buildConnectedTitleState(user)!, fontSize: 16.0,
Center( fontWeight: FontWeight.bold,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: UserAvatar(
user: user,
constraints: BoxConstraints(
maxHeight: 64.0,
minHeight: 64.0,
), ),
borderRadius: BorderRadius.circular(32.0),
), ),
), ),
), SizedBox(
if (StreamChat.of(context).user!.id != user.id) height: 5.0,
_buildModalListTile( ),
context, _buildConnectedTitleState(user)!,
StreamSvgIcon.user( Center(
color: StreamChatTheme.of(context).colorTheme.grey, child: Padding(
size: 24.0, padding: const EdgeInsets.all(16.0),
), child: UserAvatar(
'View info', user: user,
() async { constraints: BoxConstraints(
var client = StreamChat.of(context).client; maxHeight: 64.0,
minHeight: 64.0,
var c = client.channel('messaging', extraData: {
'members': [
user.id,
StreamChat.of(context).user!.id,
],
});
await c.watch();
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StreamChannel(
channel: c,
child: ChatInfoScreen(
messageTheme: widget.messageTheme,
user: user,
),
),
), ),
); borderRadius: BorderRadius.circular(32.0),
}, ),
),
if (StreamChat.of(context).user!.id != user.id)
_buildModalListTile(
context,
StreamSvgIcon.message(
color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0,
), ),
'Message',
() async {
var client = StreamChat.of(context).client;
var c = client.channel('messaging', extraData: {
'members': [
user.id,
StreamChat.of(context).user!.id,
],
});
await c.watch();
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StreamChannel(
channel: c,
child: ChannelPage(),
),
),
);
},
), ),
// if (!channel.isDistinct && if (StreamChat.of(context).user!.id != user.id)
// StreamChat.of(context).user!.id != user.id && _buildModalListTile(
// isUserAdmin)
// _buildModalListTile(
// context,
// StreamSvgIcon.iconUserSettings(
// color: StreamChatTheme.of(context).colorTheme.grey,
// size: 24.0,
// ),
// 'Make Owner', () {
// // TODO: Add make owner implementation (Remaining from backend)
// }),
if (!channel.isDistinct &&
StreamChat.of(context).user!.id != user.id &&
isUserAdmin)
_buildModalListTile(
context, context,
StreamSvgIcon.userRemove( StreamSvgIcon.user(
color: StreamChatTheme.of(context).colorTheme.accentRed, color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0, size: 24.0,
), ),
'Remove From Group', () async { 'View info',
final res = await showConfirmationDialog( () async {
context, var client = StreamChat.of(context).client;
title: 'Remove member',
okText: 'REMOVE',
question: 'Are you sure you want to remove this member?',
cancelText: 'CANCEL',
);
if (res == true) { var c = client.channel('messaging', extraData: {
await channel.removeMembers([user.id]); 'members': [
} user.id,
Navigator.pop(context); StreamChat.of(context).user!.id,
}, color: StreamChatTheme.of(context).colorTheme.accentRed), ],
_buildModalListTile( });
context,
StreamSvgIcon.closeSmall( await c.watch();
color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0, await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StreamChannel(
channel: c,
child: ChatInfoScreen(
messageTheme: widget.messageTheme,
user: user,
),
),
),
);
},
), ),
'Cancel', () { if (StreamChat.of(context).user!.id != user.id)
Navigator.pop(context); _buildModalListTile(
}), context,
], StreamSvgIcon.message(
color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0,
),
'Message',
() async {
var client = StreamChat.of(context).client;
var c = client.channel('messaging', extraData: {
'members': [
user.id,
StreamChat.of(context).user!.id,
],
});
await c.watch();
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StreamChannel(
channel: c,
child: ChannelPage(),
),
),
);
},
),
// if (!channel.isDistinct &&
// StreamChat.of(context).user!.id != user.id &&
// isUserAdmin)
// _buildModalListTile(
// context,
// StreamSvgIcon.iconUserSettings(
// color: StreamChatTheme.of(context).colorTheme.grey,
// size: 24.0,
// ),
// 'Make Owner', () {
// // TODO: Add make owner implementation (Remaining from backend)
// }),
if (!channel.isDistinct &&
StreamChat.of(context).user!.id != user.id &&
isUserAdmin)
_buildModalListTile(
context,
StreamSvgIcon.userRemove(
color:
StreamChatTheme.of(context).colorTheme.accentRed,
size: 24.0,
),
'Remove From Group', () async {
final res = await showConfirmationDialog(
context,
title: 'Remove member',
okText: 'REMOVE',
question:
'Are you sure you want to remove this member?',
cancelText: 'CANCEL',
);
if (res == true) {
await channel.removeMembers([user.id]);
}
Navigator.pop(context);
}, color: StreamChatTheme.of(context).colorTheme.accentRed),
_buildModalListTile(
context,
StreamSvgIcon.closeSmall(
color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0,
),
'Cancel', () {
Navigator.pop(context);
}),
],
),
), ),
), ),
); );