fix: adjust spacing in invitation page (#4496)
This commit is contained in:
parent
e1d52c5328
commit
ccf5cb798d
1 changed files with 106 additions and 107 deletions
|
|
@ -86,9 +86,12 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
body: MaxWidthBody(
|
||||
maxWidth: 800.0,
|
||||
withScrolling: false,
|
||||
showBorder: false,
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
spacing: 12.0,
|
||||
children: [
|
||||
TextField(
|
||||
controller: controller.controller,
|
||||
|
|
@ -122,7 +125,6 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
),
|
||||
onChanged: controller.searchUserWithCoolDown,
|
||||
),
|
||||
const SizedBox(height: 12.0),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SingleChildScrollView(
|
||||
|
|
@ -149,119 +151,114 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 40.0),
|
||||
child: StreamBuilder<Object>(
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == room.id)
|
||||
.rateLimit(const Duration(seconds: 1)),
|
||||
builder: (context, snapshot) {
|
||||
final participants =
|
||||
room.getParticipants().map((user) => user.id).toSet();
|
||||
return controller.filter == InvitationFilter.public
|
||||
? ListView.builder(
|
||||
itemCount: controller.foundProfiles.length,
|
||||
itemBuilder: (BuildContext context, int i) =>
|
||||
_InviteContactListTile(
|
||||
profile: controller.foundProfiles[i],
|
||||
isMember: participants.contains(
|
||||
controller.foundProfiles[i].userId,
|
||||
),
|
||||
onTap: () => controller.inviteAction(
|
||||
controller.foundProfiles[i].userId,
|
||||
),
|
||||
controller: controller,
|
||||
child: StreamBuilder<Object>(
|
||||
stream: room.client.onRoomState.stream
|
||||
.where((update) => update.roomId == room.id)
|
||||
.rateLimit(const Duration(seconds: 1)),
|
||||
builder: (context, snapshot) {
|
||||
final participants =
|
||||
room.getParticipants().map((user) => user.id).toSet();
|
||||
return controller.filter == InvitationFilter.public
|
||||
? ListView.builder(
|
||||
itemCount: controller.foundProfiles.length,
|
||||
itemBuilder: (BuildContext context, int i) =>
|
||||
_InviteContactListTile(
|
||||
profile: controller.foundProfiles[i],
|
||||
isMember: participants.contains(
|
||||
controller.foundProfiles[i].userId,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: contacts.length + 2,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
return controller.filter ==
|
||||
InvitationFilter.space &&
|
||||
controller.spaceParent != null
|
||||
? ListTile(
|
||||
leading: ClipPath(
|
||||
clipper: MapClipper(),
|
||||
child: Avatar(
|
||||
mxContent: controller
|
||||
.spaceParent!.avatar,
|
||||
name: controller.spaceParent!
|
||||
.getLocalizedDisplayname(),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConfig.borderRadius / 4,
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
controller.spaceParent!
|
||||
onTap: () => controller.inviteAction(
|
||||
controller.foundProfiles[i].userId,
|
||||
),
|
||||
controller: controller,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: contacts.length + 2,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
return controller.filter ==
|
||||
InvitationFilter.space &&
|
||||
controller.spaceParent != null
|
||||
? ListTile(
|
||||
leading: ClipPath(
|
||||
clipper: MapClipper(),
|
||||
child: Avatar(
|
||||
mxContent:
|
||||
controller.spaceParent!.avatar,
|
||||
name: controller.spaceParent!
|
||||
.getLocalizedDisplayname(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(
|
||||
L10n.of(context).countParticipants(
|
||||
controller.spaceParent!.summary
|
||||
.mJoinedMemberCount ??
|
||||
1,
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.borderRadius / 4,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailing: TextButton.icon(
|
||||
onPressed:
|
||||
controller.inviteAllInSpace,
|
||||
label: Text(
|
||||
L10n.of(context).inviteAllInSpace,
|
||||
),
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
)
|
||||
: const SizedBox();
|
||||
}
|
||||
|
||||
i--;
|
||||
|
||||
if (i == contacts.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SizedBox(
|
||||
width: 450,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:
|
||||
"${AppConfig.assetsBaseURL}/${RoomSettingsConstants.referFriendAsset}",
|
||||
errorWidget: (context, url, error) =>
|
||||
const SizedBox(),
|
||||
placeholder: (context, url) =>
|
||||
const Center(
|
||||
child: CircularProgressIndicator
|
||||
.adaptive(),
|
||||
),
|
||||
title: Text(
|
||||
controller.spaceParent!
|
||||
.getLocalizedDisplayname(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(
|
||||
L10n.of(context).countParticipants(
|
||||
controller.spaceParent!.summary
|
||||
.mJoinedMemberCount ??
|
||||
1,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailing: TextButton.icon(
|
||||
onPressed:
|
||||
controller.inviteAllInSpace,
|
||||
label: Text(
|
||||
L10n.of(context).inviteAllInSpace,
|
||||
),
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
)
|
||||
: const SizedBox();
|
||||
}
|
||||
|
||||
i--;
|
||||
|
||||
if (i == contacts.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SizedBox(
|
||||
width: 450,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:
|
||||
"${AppConfig.assetsBaseURL}/${RoomSettingsConstants.referFriendAsset}",
|
||||
errorWidget: (context, url, error) =>
|
||||
const SizedBox(),
|
||||
placeholder: (context, url) =>
|
||||
const Center(
|
||||
child: CircularProgressIndicator
|
||||
.adaptive(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return _InviteContactListTile(
|
||||
user: contacts[i],
|
||||
profile: Profile(
|
||||
avatarUrl: contacts[i].avatarUrl,
|
||||
displayName: contacts[i].displayName ??
|
||||
contacts[i].id.localpart ??
|
||||
L10n.of(context).user,
|
||||
userId: contacts[i].id,
|
||||
),
|
||||
isMember:
|
||||
participants.contains(contacts[i].id),
|
||||
onTap: () => controller.inviteAction(
|
||||
contacts[i].id,
|
||||
),
|
||||
controller: controller,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
}
|
||||
return _InviteContactListTile(
|
||||
user: contacts[i],
|
||||
profile: Profile(
|
||||
avatarUrl: contacts[i].avatarUrl,
|
||||
displayName: contacts[i].displayName ??
|
||||
contacts[i].id.localpart ??
|
||||
L10n.of(context).user,
|
||||
userId: contacts[i].id,
|
||||
),
|
||||
isMember: participants.contains(contacts[i].id),
|
||||
onTap: () => controller.inviteAction(
|
||||
contacts[i].id,
|
||||
),
|
||||
controller: controller,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Row(
|
||||
|
|
@ -312,7 +309,9 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
"$initialUrl/#/join_with_link?${SpaceConstants.classCode}=${room.classCode}";
|
||||
}
|
||||
|
||||
await Clipboard.setData(ClipboardData(text: toCopy));
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: toCopy),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue