是否有任何确定的Sliver小部件列表
我正在尝试使用Sliver来实现可折叠列表头。当我将小部件从普通更改为Sliver时,通常会遇到如下错误:
I/flutter ( 3141): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════I/flutter ( 3141): The following assertion was thrown building NotificationListener<ScrollNotification>():
I/flutter ( 3141): A RenderViewport expected a child of type RenderSliver but received a child of type
I/flutter ( 3141): RenderRepaintBoundary.
I/flutter ( 3141): RenderObjects expect specific types of children because they coordinate with their children during
I/flutter ( 3141): layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a
I/flutter ( 3141): RenderSliver does not understand the RenderBox layout protocol.
I/flutter ( 3141):
I/flutter ( 3141): The RenderViewport that expected a RenderSliver child was created by:
I/flutter ( 3141): Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#307856652] ← Listener ← _GestureSemantics ←
I/flutter ( 3141): RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#701223524] ← RepaintBoundary ←
I/flutter ( 3141): CustomPaint ← RepaintBoundary ← NotificationListener<ScrollNotification> ←
I/flutter ( 3141): GlowingOverscrollIndicator ← Scrollable ← ⋯
I/flutter ( 3141):
I/flutter ( 3141): The RenderRepaintBoundary that did not match the expected child type was created by:
I/flutter ( 3141): RepaintBoundary ← NotificationListener<ScrollNotification> ← GlowingOverscrollIndicator ←
I/flutter ( 3141): Scrollable ← SingleChildScrollView ← Viewport ← _ScrollableScope ←
I/flutter ( 3141): IgnorePointer-[GlobalKey#307856652] ← Listener ← _GestureSemantics ←
I/flutter ( 3141): RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#701223524] ← RepaintBoundary ← ⋯
I/flutter ( 3141):
我的理解是,这是因为普通小部件不能直接用于Sliver小部件中进行渲染。
框架中是否有明确的Sliver小部件列表?
sliver.dart
表现不多
回答:
目前RenderSliver
看来,用于docs的文档是我们最需要确定的Sliver文档。
RenderSliver
由实施
RenderSliverHelpers
(mixin)RenderSliverMultiBoxAdaptor
(抽象)RenderSliverFixedExtentBoxAdaptor
(抽象)_RenderSliverPrototypeExtentList
(具体)RenderSliverFillViewport
(具体)RenderSliverFixedExtentList
(具体)RenderSliverGrid
(具体)RenderSliverList
(具体)
RenderSliverPadding
(具体)RenderSliverPersistentHeader
(抽象)RenderSliverFloatingPersistentHeader
(具体)RenderSliverFloatingPinnedPersistentHeader
(具体)RenderSliverPinnedPersistentHeader
(具体)RenderSliverScrollingPersistentHeader
(具体)
RenderSliverSingleBoxAdapter
(抽象)RenderSliverFillRemaining
(具体)RenderSliverToBoxAdapter
(具体)
这些RenderSliver
实现由以下窗口小部件创建:
SliverMultiBoxAdaptorWidget
子类:
SliverPrototypeExtentList
SliverFillViewport
SliverFixedExtentList
SliverGrid
SliverList
StatelessWidget
子类:
SliverPersistentHeader
- 由…使用
SliverAppBar
- 由…使用
SingleChildRenderObjectWidget
子类:
SliverFillRemaining
SliverPadding
SliverToBoxAdapter
因此,当您要生成的实例时可以使用这些小部件RenderSliver
。
当然,RenderSliver
随着时间的推移,可能会添加越来越多的创建小部件,您也可以自己制作!希望此列表足以使您入门。
以上是 是否有任何确定的Sliver小部件列表 的全部内容, 来源链接: utcz.com/qa/430880.html