Repository navigation
Conversation
|
Warning Review limit reachedYou'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. View limit details
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. |
jbrnzl
left a comment
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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? |
47a4302 to
08da6f6
Compare
|
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 |
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
08da6f6 to
59549a4
Compare
| @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); | ||
| }); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Split into three groups (layout, collapse, scroll), each under 70 lines; same 11 tests. In 59549a4.
There was a problem hiding this comment.
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.
Closes #2000
Summary
The group info header was a pinned and floating
SliverAppBarwith a fixedtoolbarHeight. 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
expandedHeightapp 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
SliverOverlapAbsorberstays. 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: TabBarThe tap-to-expand
AnimationControllerin the same file is unrelated to scrolling and stays.Evidence
Tested on
59549a498(clips recorded on273eb2337;lib/is identical, the later changes only touch the test) · iPhone 18 Pro simulator, iOS 27.2 (debug build) · basea82560a03for "before"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 clipchat_details_app_bar_test.dart, 11 testsflutter 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: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
lib/pages/chat_profile_info/chat_profile_info_app_bar.dart) is unchanged; [Improvement] Remove scroll animation in group chat info #2000 is about group info only. Its Media, Links and Files content already starts right below the tabs (clip 4).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.lib/(chat_details_app_bar.dart, 119 lines changed, most of it re-indentation; hide whitespace to review), 1 new test filelib/ortest/the group header scrolls with the list, at the same speedfails withCollapseMode.parallax;the group header spans the full widthfails with a horizontal inset around the header;the first member starts right below the tabsandthe members list starts below the collapsed tabsfail when the tab body also injects the absorbed heightMerge 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.