fix: fixed group member list

This commit is contained in:
Deven Joshi
2020-12-31 14:19:03 +05:30
parent f8ea853486
commit f02f8a27cb
2 changed files with 121 additions and 60 deletions
+62 -4
View File
@@ -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,10 +163,15 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
} }
return ListView.builder( groupMemberListLength ??=
snapshot.data.members.length > 6 ? 6 : snapshot.data.members.length;
return Column(
children: [
ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: snapshot.data.members.length, itemCount: groupMemberListLength,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return Material( return Material(
child: InkWell( child: InkWell(
@@ -196,7 +203,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
children: [ children: [
Text( Text(
snapshot.data.members[position].user.name, snapshot.data.members[position].user.name,
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(
fontWeight: FontWeight.bold),
), ),
SizedBox( SizedBox(
height: 1.0, height: 1.0,
@@ -213,7 +221,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
snapshot.data.members[position].role == 'owner' snapshot.data.members[position].role ==
'owner'
? 'Owner' ? 'Owner'
: '', : '',
style: TextStyle( style: TextStyle(
@@ -233,6 +242,55 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
color: Colors.white, 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),
),
],
),
),
),
),
],
); );
}, },
future: _memberQueryFuture, future: _memberQueryFuture,
+4 -1
View File
@@ -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,