Skip to content
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

child view can not be Container #3

Closed
lucasjinreal opened this issue May 29, 2018 · 4 comments
Closed

child view can not be Container #3

lucasjinreal opened this issue May 29, 2018 · 4 comments

Comments

@lucasjinreal
Copy link

The child parameter can not be Container:

return new SmartRefresher(
        enablePullDown: true,
        enablePullUp: true,
        // refreshMode: this.refreshing,
        // loadMode: this.loading,
        onRefresh: _onRefresh,
        // headerBuilder: _buildHeader,
        // onOffsetChange: _onOffsetCallback,
        child: new Container(
            color: Colors.white,
            child: new Column(
              children: <Widget>[
                // headBannerSection,
                carouselBanner,
                _buildCategorySection(context),
                _buildListViewContent(),
              ],
            )));
  }

This gives an error.

@peng8350
Copy link
Owner

Yes,I have modified the latest version to be ScrollView type only, because listView can not cache item without doing so. You can wrap it in ListView too

@lucasjinreal
Copy link
Author

@peng8350 Thanks for your reply, I am previously using a ListView contains all my sections, however there was an error:

[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
NoSuchMethodError: The method 'onDragEnd' was called on null.
Receiver: null
Tried calling: onDragEnd(Instance of 'ScrollEndNotification')
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
#1      _SmartRefresherState._handleScrollEnd (package:pull_to_refresh/src/smart_refresher.dart:117:41)
#2      _SmartRefresherState._dispatchScrollEvent (package:pull_to_refresh/src/smart_refresher.dart:137:7)
#3      NotificationListener._dispatch (package:flutter/src/widgets/notification_listener.dart:125:27)
#4      Notification.visitAncestor (package:flutter/src/widgets/notification_listener.dart:45:20)
#5      _ScrollNotification&LayoutChangedNotification&ViewportNotificationMixin.visitAncestor (package:flutter/src/widgets/scroll_notification.dart:35:18)
#6      Element.visitAncestorElements (package:flutter/src/widgets/framework.dart:3295:39)
#7      Notification.dispatch (package:flutter/src/widgets/notification_listener.dart:59:12)

Here is my codes:

@override
  Widget build(BuildContext context) {
    return new SmartRefresher(
        enablePullDown: true,
        enablePullUp: true,
        // refreshMode: this.refreshing,
        // loadMode: this.loading,
        controller: _refreshController,
        onRefresh: _onRefresh,
        // headerBuilder: _buildHeader,
        // onOffsetChange: _onOffsetCallback,
        // child: new Container(
        //     color: Colors.white,
        //     child: new Column(
        //       children: <Widget>[
        //         // headBannerSection,
        //         carouselBanner,
        //         _buildCategorySection(context),
        //         _buildListViewContent(),
        //       ],
        //     )));
        child: new ListView(
          children: <Widget>[
            carouselBanner,
                _buildCategorySection(context),
                _buildListViewContent(),
          ],
        )
      );
  }

The comment are the previous code, any suggestions?

@peng8350
Copy link
Owner

The problem is that there are no default headerBuilder and footerBuilder inside, you only need to add the two attributes. I'll give it a default indicator in the next version

@lucasjinreal
Copy link
Author

Thanks!!! Solved problem!!

peng8350 added a commit that referenced this issue Jun 19, 2018
@gxg-886 gxg-886 mentioned this issue Nov 25, 2019
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

No branches or pull requests

2 participants