fix: always jump to top of list when switching filter tabs on Participants page (#5881)
* Initial plan * fix: scroll to top of list when switching filters on Participants page Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
This commit is contained in:
parent
1f5908721b
commit
fa49a7f7f7
2 changed files with 12 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ class PangeaInvitationSelection extends StatefulWidget {
|
|||
class PangeaInvitationSelectionController
|
||||
extends State<PangeaInvitationSelection> {
|
||||
TextEditingController controller = TextEditingController();
|
||||
ScrollController scrollController = ScrollController();
|
||||
|
||||
bool loading = false;
|
||||
|
||||
|
|
@ -131,6 +132,12 @@ class PangeaInvitationSelectionController
|
|||
_addJoinCode();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String filterLabel(InvitationFilter filter) {
|
||||
final l10n = L10n.of(context);
|
||||
switch (filter) {
|
||||
|
|
@ -263,6 +270,9 @@ class PangeaInvitationSelectionController
|
|||
if (newFilter == InvitationFilter.public) {
|
||||
searchUser(context, controller.text);
|
||||
}
|
||||
if (scrollController.hasClients) {
|
||||
scrollController.jumpTo(0);
|
||||
}
|
||||
setState(() => filter = newFilter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: controller.scrollController,
|
||||
itemCount: controller.foundProfiles.length,
|
||||
itemBuilder: (BuildContext context, int i) =>
|
||||
_InviteContactListTile(
|
||||
|
|
@ -176,6 +177,7 @@ class PangeaInvitationSelectionView extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: controller.scrollController,
|
||||
itemCount: contacts.length + 2,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue