这是indexloc提供的服务,不要输入任何密码
Skip to content

DecoratedSliver #127823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 20, 2023
Merged

DecoratedSliver #127823

merged 21 commits into from
Jun 20, 2023

Conversation

thkim1011
Copy link
Contributor

@thkim1011 thkim1011 commented May 30, 2023

This is a second attempt to merge #107269. Currently I've fixed two of the issues:

  1. Fixed horizontal scrollview by using a switch statement to consider vertical/horizontal case.
  2. Fixed issue of paintExtent not being the right extent for painting. Rather using a scrollExtent for the main axis length of the decoration box and painting it offsetted by the scrollOffset.
  3. If the sliver child has inifinite scrollExtent, then we only draw the decoration down to the bottom of the cacheExtent. The developer is expected to ensure that the border does not creep up above the cache area.

This PR includes a test that checks that the correct rectangle is drawn at a certain scrollOffset for both the horizontal and vertical case which should be sufficient for checking that SliverDecoration works properly now.

Fixes #107498.

@flutter-dashboard flutter-dashboard bot added f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels May 30, 2023
@github-actions github-actions bot removed framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels May 30, 2023
@thkim1011 thkim1011 marked this pull request as draft May 30, 2023 16:38
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels May 30, 2023
@thkim1011 thkim1011 changed the title [WIP] Sliver Decoration Sliver Decoration May 30, 2023
@thkim1011 thkim1011 marked this pull request as ready for review May 30, 2023 23:35
@thkim1011 thkim1011 requested a review from Piinks May 30, 2023 23:35
@github-actions github-actions bot removed f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels May 30, 2023
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

I'd like to test this with the sliver group widgets once they land, that would make for a pretty great sample app to include here.

@goderbauer goderbauer added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Jun 1, 2023
@github-actions github-actions bot added the d: api docs Issues with https://api.flutter.dev/ label Jun 12, 2023
@Piinks
Copy link
Contributor

Piinks commented Jun 13, 2023

Also, looks like the analyzer is unhappy here.

@thkim1011 thkim1011 requested a review from Piinks June 14, 2023 09:32
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Looks like the docs tests are failing since SliverDecoration was renamed but is still used throughout the docs.

@thkim1011 thkim1011 changed the title Sliver Decoration DecoratedSliver Jun 14, 2023
@thkim1011 thkim1011 requested a review from Piinks June 14, 2023 20:35
Comment on lines 19 to 20
/// it is necessary to ensure that the bottom border does not creep
/// above the top of the bottom cache.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this mean to the developer? Can you explain why/when this would happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an explanation on how this can happen.

/// Commonly used with [BoxDecoration].
///
/// The [child] is not clipped. To clip a child to the shape of a particular
/// [ShapeDecoration], consider using a [ClipPath] widget.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean users cannot provide a ShapeDecoration to DecoratedSliver.decoration? Or should not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They could but it won't clip the contents of the child. I guess the developer should try to guarantee that the contents of the child fits within the decoration.

));
});

testWidgets('DecoratedSliver works with SliverMainAxisGroup', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test for cross axis group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -0,0 +1,388 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add tests for reverse in the horizontal and vertical axes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

thkim1011 and others added 3 commits June 20, 2023 02:02
@thkim1011 thkim1011 requested a review from Piinks June 20, 2023 17:39
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Flutter_LGTM

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@auto-submit auto-submit bot merged commit 541fdd6 into flutter:master Jun 20, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 21, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 22, 2023
Manual version of #4269

----

Roll Flutter from fc8856e to c40baf4 (57 revisions)

flutter/flutter@fc8856e...c40baf4

2023-06-21 engine-flutter-autoroll@skia.org Roll Packages from 6e1918f to 0fdf05f (8 revisions) (flutter/flutter#129286)
2023-06-21 christopherfujino@gmail.com move test ownership from zanderso -> tools team (flutter/flutter#129199)
2023-06-21 42216813+eliasyishak@users.noreply.github.com Refactor `Analytics` global getter to point to context only (flutter/flutter#129196)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from cfbd3652532d to f973fb4636d3 (1 revision) (flutter/flutter#129253)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 059643dcc8e3 to cfbd3652532d (1 revision) (flutter/flutter#129243)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5313ca367549 to 059643dcc8e3 (1 revision) (flutter/flutter#129240)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 946f523859fe to 5313ca367549 (2 revisions) (flutter/flutter#129234)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from e5a860c5479c to 946f523859fe (2 revisions) (flutter/flutter#129232)
2023-06-21 31859944+LongCatIsLooong@users.noreply.github.com Relax `OverlayPortal` asserts (flutter/flutter#129053)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from adfc3af300a9 to e5a860c5479c (3 revisions) (flutter/flutter#129228)
2023-06-21 godofredoc@google.com Move all the firebase lab device configs to .ci.yaml. (flutter/flutter#129219)
2023-06-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7d4abb81ccd1 to adfc3af300a9 (2 revisions) (flutter/flutter#129225)
2023-06-20 andrewrkolos@gmail.com update resolution-aware asset docs links (flutter/flutter#128769)
2023-06-20 jmccandless@google.com Fix: Magnifier appears and won't dismiss (flutter/flutter#128545)
2023-06-20 thkim1011@users.noreply.github.com DecoratedSliver (flutter/flutter#127823)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 666244148e89 to 7d4abb81ccd1 (1 revision) (flutter/flutter#129217)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 06d0c08460e5 to 666244148e89 (2 revisions) (flutter/flutter#129208)
2023-06-20 yeasinsheikh50@gmail.com fixed PreferredSize constuctor invocations (flutter/flutter#128181)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1c16af76ca26 to 06d0c08460e5 (3 revisions) (flutter/flutter#129200)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from ec64672afd91 to 1c16af76ca26 (1 revision) (flutter/flutter#129197)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4444ede34a9c to ec64672afd91 (3 revisions) (flutter/flutter#129194)
2023-06-20 15619084+vashworth@users.noreply.github.com Fix duplicate devices from xcdevice with iOS 17 (flutter/flutter#128802)
2023-06-20 ychris@google.com iOS info.plist template: make UIViewControllerBasedStatusBar to be true (flutter/flutter#128970)
2023-06-20 whesse@google.com Fix detection that tests are running on monorepo bots (flutter/flutter#129173)
2023-06-20 chingjun@google.com Use the new `getIsolatePauseEvent` method from VM service to check for pause event. (flutter/flutter#128834)
2023-06-20 31922733+SwaroopSambhayya@users.noreply.github.com Adding ScrollController support for Stepper widget (flutter/flutter#128814)
2023-06-20 engine-flutter-autoroll@skia.org Roll Packages from 59d93d6 to 6e1918f (6 revisions) (flutter/flutter#129176)
2023-06-20 thkim1011@users.noreply.github.com Refactor generate_localizations_test.dart (flutter/flutter#128974)
2023-06-20 kevinjchisholm@google.com [process] Add a design doc issue template. (flutter/flutter#128361)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from bd6d3fc90462 to 4444ede34a9c (1 revision) (flutter/flutter#129169)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 73c4ba4240cc to bd6d3fc90462 (1 revision) (flutter/flutter#129168)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7ee874792067 to 73c4ba4240cc (1 revision) (flutter/flutter#129162)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6a6c8fb591f5 to 7ee874792067 (1 revision) (flutter/flutter#129160)
2023-06-20 leigha.jarett@gmail.com Add to API docs to explain what Assist and Suggestion chips are (flutter/flutter#129034)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from a91bb3f566b9 to 6a6c8fb591f5 (1 revision) (flutter/flutter#129158)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from e0d456d9251b to a91bb3f566b9 (1 revision) (flutter/flutter#129148)
2023-06-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 55418e648958 to e0d456d9251b (1 revision) (flutter/flutter#129146)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 84ecaa053ec6 to 55418e648958 (1 revision) (flutter/flutter#129145)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 23a2c246600f to 84ecaa053ec6 (2 revisions) (flutter/flutter#129142)
2023-06-19 tessertaha@gmail.com Introduce MaterialState `color` property for chips (flutter/flutter#128584)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 280491d4cc21 to 23a2c246600f (8 revisions) (flutter/flutter#129140)
2023-06-19 jason-simmons@users.noreply.github.com Fix an ordering dependency in the flutter_tools upgrade test (flutter/flutter#129131)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 164c6b49dfb5 to 280491d4cc21 (1 revision) (flutter/flutter#129102)
2023-06-19 tessertaha@gmail.com Fix `InputDecoration.applyDefaults` ignoring some properties (flutter/flutter#129010)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from d298f0bf720c to 164c6b49dfb5 (1 revision) (flutter/flutter#129100)
2023-06-19 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7ffa1355f718 to d298f0bf720c (24 revisions) (flutter/flutter#129092)
...

----
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement SliverDecoration
4 participants