fix: fixed group member list
This commit is contained in:
@@ -32,6 +32,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
bool namedChanged = false;
|
bool namedChanged = false;
|
||||||
String changedName = '';
|
String changedName = '';
|
||||||
|
|
||||||
|
int groupMemberListLength;
|
||||||
|
|
||||||
void _userNameListener() {
|
void _userNameListener() {
|
||||||
if (_searchController.text == _userNameQuery) {
|
if (_searchController.text == _userNameQuery) {
|
||||||
return;
|
return;
|
||||||
@@ -161,78 +163,134 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListView.builder(
|
groupMemberListLength ??=
|
||||||
shrinkWrap: true,
|
snapshot.data.members.length > 6 ? 6 : snapshot.data.members.length;
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: snapshot.data.members.length,
|
return Column(
|
||||||
itemBuilder: (context, position) {
|
children: [
|
||||||
return Material(
|
ListView.builder(
|
||||||
child: InkWell(
|
shrinkWrap: true,
|
||||||
onTap: () {
|
physics: NeverScrollableScrollPhysics(),
|
||||||
var userMember = snapshot.data.members.firstWhere(
|
itemCount: groupMemberListLength,
|
||||||
(e) => e.user.id == StreamChat.of(context).user.id);
|
itemBuilder: (context, position) {
|
||||||
_showUserInfoModal(snapshot.data.members[position].user,
|
return Material(
|
||||||
userMember.role == 'owner');
|
child: InkWell(
|
||||||
},
|
onTap: () {
|
||||||
child: Container(
|
var userMember = snapshot.data.members.firstWhere(
|
||||||
height: 65.0,
|
(e) => e.user.id == StreamChat.of(context).user.id);
|
||||||
child: Column(
|
_showUserInfoModal(snapshot.data.members[position].user,
|
||||||
children: [
|
userMember.role == 'owner');
|
||||||
Row(
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 65.0,
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Row(
|
||||||
padding: const EdgeInsets.symmetric(
|
children: [
|
||||||
horizontal: 8.0, vertical: 12.0),
|
Padding(
|
||||||
child: UserAvatar(
|
padding: const EdgeInsets.symmetric(
|
||||||
user: snapshot.data.members[position].user,
|
horizontal: 8.0, vertical: 12.0),
|
||||||
constraints: BoxConstraints(
|
child: UserAvatar(
|
||||||
maxHeight: 40.0, maxWidth: 40.0),
|
user: snapshot.data.members[position].user,
|
||||||
),
|
constraints: BoxConstraints(
|
||||||
),
|
maxHeight: 40.0, maxWidth: 40.0),
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
snapshot.data.members[position].user.name,
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
height: 1.0,
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
snapshot.data.members[position].user.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 1.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
_getLastSeen(
|
||||||
|
snapshot.data.members[position].user),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black.withOpacity(0.5)),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
_getLastSeen(
|
Padding(
|
||||||
snapshot.data.members[position].user),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
snapshot.data.members[position].role ==
|
||||||
|
'owner'
|
||||||
|
? 'Owner'
|
||||||
|
: '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black.withOpacity(0.5)),
|
color: Colors.black.withOpacity(0.5)),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
height: 1.0,
|
||||||
child: Text(
|
color: Color(0xffdbdbdb),
|
||||||
snapshot.data.members[position].role == 'owner'
|
|
||||||
? 'Owner'
|
|
||||||
: '',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black.withOpacity(0.5)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
),
|
||||||
height: 1.0,
|
),
|
||||||
color: Color(0xffdbdbdb),
|
color: Colors.white,
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
|
),
|
||||||
|
if (groupMemberListLength != snapshot.data.members.length)
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
groupMemberListLength = snapshot.data.members.length;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Material(
|
||||||
|
child: Container(
|
||||||
|
height: 65.0,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 21.0, vertical: 12.0),
|
||||||
|
child: StreamSvgIcon.down(
|
||||||
|
color: Color(0xff7a7a7a),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${snapshot.data.members.length - groupMemberListLength} more',
|
||||||
|
style:
|
||||||
|
TextStyle(color: Color(0xff7a7a7a)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 1.0,
|
||||||
|
color: Color(0xffdbdbdb),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
color: Colors.white,
|
],
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
future: _memberQueryFuture,
|
future: _memberQueryFuture,
|
||||||
|
|||||||
@@ -104,7 +104,10 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox.fromSize(
|
return SizedBox.fromSize(
|
||||||
size: widget.preferredSize,
|
size: Size(
|
||||||
|
MediaQuery.of(context).size.width,
|
||||||
|
MediaQuery.of(context).padding.bottom + widget.preferredSize.height,
|
||||||
|
),
|
||||||
child: MediaQuery.removePadding(
|
child: MediaQuery.removePadding(
|
||||||
context: context,
|
context: context,
|
||||||
removeTop: true,
|
removeTop: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user