extended_nested_scroll_view 0.3.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 95

extended_nested_scroll_view #

pub package GitHub stars GitHub forks GitHub license GitHub issues flutter-candies

Language: English | 中文简体

NestedScrollView: 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

Chinese blog

Example for issue 1 #

give total height of pinned sliver headers in pinnedHeaderSliverHeightBuilder callback

 var tabBarHeight = primaryTabBar.preferredSize.height;
      var pinnedHeaderHeight =
          //statusBar height
          statusBarHeight +
              //pinned SliverAppBar height in header
              kToolbarHeight;

 return NestedScrollView(
        pinnedHeaderSliverHeightBuilder: () {
          return pinnedHeaderHeight;
        },
       

Example for issue 2 #

Step1 #

Put your list which in tabview into NestedScrollViewInnerScrollPositionKeyWidget,and get unique a key

 return extended.NestedScrollViewInnerScrollPositionKeyWidget(
        widget.tabKey,
        ListView.builder(
            itemBuilder: (c, i) {
              return Container(
                alignment: Alignment.center,
                height: 60.0,
                child: Text(widget.tabKey.toString() + ": List$i"),
              );
            },
            itemCount: 100)
        );

Step2 #

get current tab key in innerScrollPositionKeyBuilder callback. this key should as same as in step 1 given.

 extended.NestedScrollView(
        innerScrollPositionKeyBuilder: () {
          var index = "Tab";
          if (primaryTC.index == 0) {
            index +=
                (primaryTC.index.toString() + secondaryTC.index.toString());
          } else {
            index += primaryTC.index.toString();
          }
          return Key(index);
        },

Example for NestedScrollView pull to refresh #

NestedScrollViewRefreshIndicator is as the same as Flutter RefreshIndicator.

 NestedScrollViewRefreshIndicator(
       onRefresh: onRefresh,
       child: extended.NestedScrollView(
         headerSliverBuilder: (c, f) {
           return _buildSliverHeader(primaryTabBar);
         },

Better one to pull to refresh

Please see the example app of this for a full example.

Do without ScrollController in NestedScrollView's body #

  • due to we can't set ScrollController for list in NestedScrollView's body(it will breaking behaviours of InnerScrollController in NestedScrollView),provide Demos

  • pull to refresh,

  • load more

  • scroll to top

    to show how to do it without ScrollController

[0.3.8]

  • add NestedScrollViewState key to get currentInnerPosition/innerScrollPositions instead of ScrollController
  • due to we can't set ScrollController for list in NestedScrollView's body(it will breaking behaviours of InnerScrollController in NestedScrollView), provide demos('PullToRefresh','LoadMore' and 'ScrollToTop') to show how to do it without ScrollController

[0.3.6]

  • fix api error base on Flutter SDK v1.7.8+hotfix.2

[0.3.5]

  • New ExtendedNestedScrollView still has some issues in special layout, make it as obsolete for now till find a better solution

[0.3.3]

  • fix issue that Caught error: type 'Future

[0.2.9]

  • fix issue [0.2.5] for old extended_nested_scroll_view

[0.2.7]

  • fix issue for quick change page
  • handle unavailable page change(no actived nested positions in it)

[0.2.5]

  • fix issue that ut postion is not overscroll actually,it get minimal value and will scroll inner positions igore minimal value here(value like following data) /// I/flutter (14963): 5.684341886080802e-14 /// I/flutter (14963): -5.684341886080802e-14 if (innerDelta != 0.0 && innerDelta.abs() > 0.0001) { for (_NestedScrollPosition position in _activedInnerPositions) { position.applyFullDragUpdate(innerDelta); } }

[0.2.0]

  • update new extended_nested_scroll_view demo

[0.1.9]

  • set keepOnlyOneInnerNestedScrollPositionActive default value: false

[0.1.8]

  • update new ExtendedNestedScrollView readme

[0.1.7]

  • add assert for keepOnlyOneInnerNestedScrollPositionActive ///when ExtendedNestedScrollView body has [TabBarView]/[PageView] and children have ///AutomaticKeepAliveClientMixin or PageStorageKey, ///[_innerController.nestedPositions] will have more one, ///when you scroll, it will scroll all of nestedPositions ///set [keepOnlyOneInnerNestedScrollPositionActive] true to avoid it. ///notice: only for Axis.horizontal [TabBarView]/[PageView] and ///[scrollDirection] must be Axis.vertical. assert(!(widget.keepOnlyOneInnerNestedScrollPositionActive && widget.scrollDirection == Axis.horizontal));

[0.1.6]

  • fix issue: Actived [_NestedScrollPosition] is not right for multiple

[0.1.5]

  • add new ExtendedNestedScrollView to slove issue more smartly.

[0.1.4]

  • Update readme.

[0.1.3]

  • Update demo.

[0.1.2]

  • Remove unused method.

[0.1.1]

  • Update demo.

[0.1.0]

  • Upgrade Some Commments.

[0.0.1]

  • Initial Open Source release.

example/README.md

example #

extened nested scroll view example

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  extended_nested_scroll_view: ^0.3.8

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
91
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Health suggestions

Fix lib/src/extended_nested_scroll_view.dart. (-1.49 points)

Analysis of lib/src/extended_nested_scroll_view.dart reported 3 hints:

line 287 col 17: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

line 1231 col 17: 'ancestorStateOfType' is deprecated and shouldn't be used. Use findAncestorStateOfType instead. This feature was deprecated after v1.12.1..

line 1231 col 37: 'TypeMatcher' is deprecated and shouldn't be used. TypeMatcher has been deprecated because it is no longer used in framework(only in deprecated methods). This feature was deprecated after v1.12.1..

Fix lib/src/nested_scroll_view_inner_scroll_position_key_widget.dart. (-1 points)

Analysis of lib/src/nested_scroll_view_inner_scroll_position_key_widget.dart reported 2 hints:

line 13 col 20: 'ancestorStateOfType' is deprecated and shouldn't be used. Use findAncestorStateOfType instead. This feature was deprecated after v1.12.1..

line 14 col 9: 'TypeMatcher' is deprecated and shouldn't be used. TypeMatcher has been deprecated because it is no longer used in framework(only in deprecated methods). This feature was deprecated after v1.12.1..

Fix lib/src/old_extended_nested_scroll_view.dart. (-1 points)

Analysis of lib/src/old_extended_nested_scroll_view.dart reported 2 hints:

line 278 col 17: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

line 1140 col 15: 'ancestorWidgetOfExactType' is deprecated and shouldn't be used. Use findAncestorWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Format lib/src/nested_scroll_view_refresh_indicator.dart.

Run flutter format to format lib/src/nested_scroll_view_refresh_indicator.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test