fluttercandies / extended_nested_scroll_view

extended nested scroll view to fix following issues. 1.pinned sliver header issue 2.inner scrollables in tabview sync issue 3.pull to refresh is not work. 4.do without ScrollController in NestedScrollView's body
MIT License
591 stars 117 forks source link

[Bug report] #131

Closed dhs964057117 closed 1 year ago

dhs964057117 commented 1 year ago

Version

6.0.0

Platforms

Android

Device Model

xiao mi pad 5 android 11

flutter info

Channel stable, 3.7.7, on Ubuntu 20.04.3 LTS 5.11.0-27-generic, locale zh_CN.UTF-8
    • Dart version 2.19.4
    • DevTools version 2.20.1
    • Flutter plugin version 72.1.2
    • Dart plugin version 221.6103.1
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

How to reproduce?

when widget build

Logs

A RenderNestedScrollViewViewport expected a child of type RenderSliver but received a child of type RenderPointerListener.
RenderObjects expect specific types of children because they coordinate with their children during layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a RenderSliver does not understand the RenderBox layout protocol.

The RenderNestedScrollViewViewport that expected a RenderSliver child was created by:
  NestedScrollViewViewport ← IgnorePointer-[GlobalKey#749ea] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#551a7] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#223ef] ← NotificationListener<ScrollMetricsNotification> ← RepaintBoundary ← CustomPaint ← ⋯

The RenderPointerListener that did not match the expected child type was created by:
  Listener ← EClickWidget ← NoRobot ← NestedScrollViewViewport ← IgnorePointer-[GlobalKey#749ea] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#551a7] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#223ef] ← ⋯

Example code (optional)

Widget buildContent(BuildContext context) {
    return ExtendedNestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return [
            SliverAppBar(
                title: Text("标题"),
                centerTitle: true,
                pinned: true,
                floating: true,
                snap: false,
                expandedHeight: 200,
                elevation: 0,
                bottom: PreferredSize(
                  //定义大小
                  preferredSize: Size(MediaQuery
                      .of(context)
                      .size
                      .width, 44),
                  //配置任意的子Widget
                  child: Container(
                    alignment: Alignment.center,
                    child: Container(
                      // color: Colors.grey,
                      //随着向上滑动,TabBar的宽度逐渐增大
                      //父布局Container约束为 center对齐
                      //所以程现出来的是中间x轴放大的效果
                        width: MediaQuery
                            .of(context)
                            .size
                            .width,
                        child: (Text("child"))
                    ),
                  ),
                )),
            getRobotWidget()
          ];
        },
        body: TabBar(
          controller: logic.primaryTC,
          labelColor: Colors.blue,
          indicatorColor: Colors.blue,
          indicatorSize: TabBarIndicatorSize.label,
          indicatorWeight: 2.0,
          isScrollable: false,
          unselectedLabelColor: Colors.grey,
          tabs: const <Tab>[
            Tab(text: 'Tab0'),
            Tab(text: 'Tab1'),
          ],
        ));

Contact

No response

zmtzawqlp commented 1 year ago

getRobotWidget() must be sliver

dhs964057117 commented 1 year ago

getRobotWidget() 必须是 sliver

it works when i Annotated this code that getRobotWidget() thanks for a lot