Skip to content

fix(chat-details): Pin only the tabs when the group info list scrolls - #3952

Open
nqhhdev wants to merge 1 commit into
mainfrom
TW-2000-static-group-info-header
Open

nqhhdev wants to merge 1 commit into
mainfrom
TW-2000-static-group-info-header

Conversation

@nqhhdev

@nqhhdev nqhhdev commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Closes #2000

Summary

The group info header was a pinned and floating SliverAppBar with a fixed toolbarHeight. While the members/media list scrolled, the header content squeezed under the tabs at half speed and the list slid over it, so the members "replaced" the chat info.

The header is now an expandedHeight app bar that collapses to its tab bar: toolbarHeight: 0, expandedHeight = header + tabs, FlexibleSpaceBar(collapseMode: CollapseMode.pin), pinned: true. On scroll the header moves away with the list at the same speed, and only the tabs stay pinned. On a small phone the list gets the full height minus the tab bar once the header has collapsed.

The SliverOverlapAbsorber stays. The tab pages keep their existing top padding (ChatDetailViewStyle.paddingTabBarView), so their content still starts right below the tabs. No tab page changes.

 ChatDetailsAppBar (lib/pages/chat_details/chat_details_app_bar.dart)
   SliverOverlapAbsorber
     SliverAppBar
-      toolbarHeight: avatar + name + actions + description
-      title: header
-      floating: true
+      toolbarHeight: 0
+      expandedHeight: header + tabs
+      flexibleSpace: FlexibleSpaceBar(collapseMode: pin, background: header)
       pinned: true
       bottom: TabBar

The tap-to-expand AnimationController in the same file is unrelated to scrolling and stays.

Evidence

Tested on 59549a498 (clips recorded on 273eb2337; lib/ is identical, the later changes only touch the test) · iPhone 18 Pro simulator, iOS 27.2 (debug build) · base a82560a03 for "before"

# Case Result Evidence
D0 Demo: group info, scroll the list until only the tabs are pinned, scroll back, tap the avatar to expand the header ✅ clip 1 below
C1 Root cause, before: the header content squeezes under the tabs while the list scrolls ✅ before clip 2 below
C1 Root cause, after: the header scrolls away in one piece at the list's speed; the tabs stay pinned ✅ after clip 3 below
SMALL 375x667 phone: list height once the header has collapsed ✅ widget test on a 375x667 phone the collapsed header leaves the list all but the tabs: the list gets 618 px of the 667 px body (the 49 px tab bar stays), against 225 px with the header open. No small-phone simulator here, so this is a widget test, not a clip
R1 1:1 contact info: Media, Links and Files content still starts right below the tabs ✅ clip 4 below
T chat_details_app_bar_test.dart, 11 tests ✅ flutter test test/pages/chat_details test/pages/chat_profile_info test/pages/chat_search: +123: All tests passed!

Clip 1 (D0):

D0.mp4

Clip 2 (C1 before, main):

C1-before.mp4

Clip 3 (C1 after):

C1-after.mp4

Clip 4 (R1, 1:1 contact info):

R1.mp4

Tests in test/pages/chat_details/chat_details_app_bar_test.dart:

  • the first member starts right below the tabs
  • the group header spans the full width
  • scrolling the members collapses the header to the tabs
  • the members list starts below the collapsed tabs
  • a short members list stays below the collapsed tabs
  • the last member can be scrolled fully into view
  • tapping the group info expands the header above the tabs
  • a long description pushes the tabs below it
  • on a 375x667 phone the collapsed header leaves the list all but the tabs
  • the group header scrolls with the list, at the same speed
  • scrolling back to the top shows the group header again

Not tested on device: a group with many members (the test group has one member, so C1 shows the squeeze against the rigid scroll rather than a long list; the widget tests use 100 members), Android.

  • dart analyze: No issues found. dart format: 0 changed. pre-pr-check.sh origin/main: all checks ok.

Decisions to verify

Gate report

gate: trivial: a widget-layout change in one presentation file, with no new branch, no async code, no route, no provider and no Matrix call.

Item Result Evidence
f. Scope and size PASS 1 file in lib/ (chat_details_app_bar.dart, 119 lines changed, most of it re-indentation; hide whitespace to review), 1 new test file
f. Comments PASS no comment lines added in lib/ or test/
i. Test proves the fix PASS the group header scrolls with the list, at the same speed fails with CollapseMode.parallax; the group header spans the full width fails with a horizontal inset around the header; the first member starts right below the tabs and the members list starts below the collapsed tabs fail when the tab body also injects the absorbed height
a, b, c, d, e N/A no generated code, failure path, stack, async or account state touched

Merge Danger

Door: two-way

Reverting one file restores the old header.

Blast Radius: layout

Group info screen only. The 1:1 profile, the tab pages and the chat screen are untouched.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cec9f560-5ca0-45be-a5e1-ee061e60c924
Commits

Reviewing files that changed from the base of the PR and between a82560a and 59549a4.

Files selected for processing: 2

  • lib/pages/chat_details/chat_details_app_bar.dart
  • test/pages/chat_details/chat_details_app_bar_test.dart
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@nqhhdev
nqhhdev marked this pull request as ready for review December 4, 2026 08:51

@jbrnzl jbrnzl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: no video yet. D0, C1 before/after and R1 are still <!-- drag ... --> placeholders; please attach them.

See also the inline comment about the list height on small phones.

controller: widget.tabController,
),
automaticallyImplyLeading: false,
pinned: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With pinned and no collapse, this header now takes ~440 px for good (224 + 69 + description + tabs). On a 375×667 phone that leaves ~150 px for the member list, and less when the avatar is expanded (group info goes up to 290 px). Could you add a small-phone capture to the demo? If it's too cramped, an expandedHeight with a smaller collapsed height would keep the tabs fixed without freezing the whole header.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, a fixed 440 px header was too much on a small phone. I took your suggestion: the header is now an expandedHeight app bar whose collapsed height is only the tab bar. It scrolls away with the list and the tabs stay pinned.

No 375x667 simulator here, so I added a widget test for it: on a 375x667 phone the collapsed header leaves the list all but the tabs. In a 667 px body the list gets 225 px with the header open and 618 px once it collapses (667 minus the 49 px tab bar). Fixed in 08da6f6.

@jbrnzl

jbrnzl commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

On the header behaviour: #2000 asks to compare with Telegram (video in the issue), where the profile header scrolls away with the list as one page and nothing gets replaced by an animation. This PR freezes the header and only the tab content scrolls, which also leaves very little room for the list on small phones. Could you make the whole page scroll as one, header included, so it matches the issue?

@nqhhdev
nqhhdev force-pushed the TW-2000-static-group-info-header branch from 47a4302 to 08da6f6 Compare December 5, 2026 01:36
codescene-delta-analysis[bot]

This comment was marked as outdated.

@nqhhdev nqhhdev changed the title fix(chat-details): Keep the group info header in place when the list scrolls fix(chat-details): Pin only the tabs when the group info list scrolls Dec 5, 2026
@nqhhdev

nqhhdev commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

The videos are in the description now: D0, C1 before/after and R1, recorded on an iPhone 18 Pro simulator. The header changed after your comment (it collapses to the tabs now), so the clips show the new behaviour, not the fixed header from the old description. They were recorded on 273eb2337; the pushed head 08da6f6 has the same lib/ code plus one more test. Title and description are updated to match.

@nqhhdev
nqhhdev requested a review from jbrnzl December 5, 2026 01:37
The group info header was pinned and floating: while the member list
scrolled, its content squeezed under the tabs at half speed (#2000). It
is now an expandedHeight app bar that collapses to its tab bar: the
header scrolls away with the list at the same speed and only the tabs
stay pinned. The tab pages keep their existing top padding, so their
content still starts right below the tabs.

Closes #2000
@nqhhdev
nqhhdev force-pushed the TW-2000-static-group-info-header branch from 08da6f6 to 59549a4 Compare December 5, 2026 01:43
Comment on lines +83 to +240
@GenerateNiceMocks([MockSpec<Room>(), MockSpec<Client>()])
void main() {
group('ChatDetailsAppBar', () {
testWidgets('the first member starts right below the tabs', (tester) async {
await _pumpDetails(tester);

expect(
tester.getRect(find.text('member 0')).top,
closeTo(tester.getRect(find.byType(TabBar)).bottom, 1),
);
});

testWidgets('the group header spans the full width', (tester) async {
await _pumpDetails(tester);

expect(
tester.getRect(find.byType(ChatDetailsHeaderStack)).width,
tester.getRect(find.byType(Scaffold)).width,
);
});

testWidgets('scrolling the members collapses the header to the tabs', (
tester,
) async {
await _pumpDetails(tester);
final bodyTop = tester.getRect(find.byType(Scaffold)).top;

await _scrollMembers(tester, -2000);

expect(tester.getRect(find.byType(TabBar)).top, bodyTop);
expect(find.text(_groupName).hitTestable(), findsNothing);
});

testWidgets('the members list starts below the collapsed tabs', (
tester,
) async {
await _pumpDetails(tester);
final bodyTop = tester.getRect(find.byType(Scaffold)).top;
final collapseDistance =
tester.getRect(find.byType(TabBar)).top - bodyTop;

await _scrollMembers(tester, -collapseDistance);

expect(tester.getRect(find.byType(TabBar)).top, bodyTop);
expect(
tester.getRect(find.text('member 0')).top,
closeTo(tester.getRect(find.byType(TabBar)).bottom, 1),
);
});

testWidgets('a short members list stays below the collapsed tabs', (
tester,
) async {
await _pumpDetails(tester, memberCount: 3);

await _scrollMembers(tester, -2000);

expect(
tester.getRect(find.text('member 0')).top,
greaterThanOrEqualTo(tester.getRect(find.byType(TabBar)).bottom),
);
});

testWidgets('the last member can be scrolled fully into view', (
tester,
) async {
await _pumpDetails(tester);
final screenBottom = tester.getRect(find.byType(Scaffold)).bottom;

await _scrollMembers(tester, -_itemCount * _itemHeight * 2);

expect(
tester.getRect(find.text('member ${_itemCount - 1}')).bottom,
lessThanOrEqualTo(screenBottom),
);
});

testWidgets('tapping the group info expands the header above the tabs', (
tester,
) async {
await _pumpDetails(tester);
final tabsBefore = tester.getRect(find.byType(TabBar));

await tester.tapAt(const Offset(100, 100));
await tester.pumpAndSettle();

final tabsAfter = tester.getRect(find.byType(TabBar));
expect(tabsAfter.top, greaterThan(tabsBefore.top));
expect(
tester.getRect(find.text('member 0')).top,
greaterThanOrEqualTo(tabsAfter.bottom),
);
});

testWidgets('a long description pushes the tabs below it', (tester) async {
await _pumpDetails(tester);
final shortTabs = tester.getRect(find.byType(TabBar));

await _pumpDetails(tester, topic: List.filled(40, 'word').join(' '));

final longTabs = tester.getRect(find.byType(TabBar));
expect(longTabs.top, greaterThan(shortTabs.top));
expect(
tester.getRect(find.byType(ChatDetailsGroupDescriptionView)).bottom,
lessThanOrEqualTo(longTabs.top),
);
expect(
tester.getRect(find.text('member 0')).top,
greaterThanOrEqualTo(longTabs.bottom),
);
});

testWidgets(
'on a 375x667 phone the collapsed header leaves the list all but the tabs',
(tester) async {
tester.view.physicalSize = const Size(375, 667);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await _pumpDetails(tester);
final body = tester.getRect(find.byType(Scaffold));

await tester.dragFrom(const Offset(187, 600), const Offset(0, -2000));
await tester.pumpAndSettle();

final tabs = tester.getRect(find.byType(TabBar));
expect(tabs.top, body.top);
expect(body.bottom - tabs.bottom, body.height - tabs.height);
expect(body.bottom - tabs.bottom, greaterThan(600));
},
);

testWidgets('the group header scrolls with the list, at the same speed', (
tester,
) async {
await _pumpDetails(tester);
final nameBefore = tester.getRect(find.text(_groupName)).top;
final tabsBefore = tester.getRect(find.byType(TabBar)).top;

await _scrollMembers(tester, -100);

expect(tester.getRect(find.byType(TabBar)).top, tabsBefore - 100);
expect(tester.getRect(find.text(_groupName)).top, nameBefore - 100);
});

testWidgets('scrolling back to the top shows the group header again', (
tester,
) async {
await _pumpDetails(tester);
final nameBefore = tester.getRect(find.text(_groupName));

await _scrollMembers(tester, -2000);
await _scrollMembers(tester, 4000);

expect(tester.getRect(find.text(_groupName)), nameBefore);
expect(find.text('member 0'), findsOneWidget);
});
});
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into three groups (layout, collapse, scroll), each under 70 lines; same 11 tests. In 59549a4.

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Remove scroll animation in group chat info

2 participants