Skip to content

Commit

Permalink
primary nullable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NamanShergill committed Sep 2, 2022
1 parent 37c8b25 commit d9bc27e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 44 deletions.
35 changes: 14 additions & 21 deletions example/pubspec.lock
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
Expand All @@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -61,7 +54,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.2.2-beta"
version: "2.2.4"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -73,28 +66,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -106,7 +99,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -127,21 +120,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
vector_math:
dependency: transitive
description:
Expand All @@ -151,4 +144,4 @@ packages:
version: "2.1.2"
sdks:
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=1.17.0"
flutter: ">=3.3.0"
10 changes: 8 additions & 2 deletions lib/src/modified_scrolls/scroll_view.dart
Expand Up @@ -51,8 +51,13 @@ abstract class ScrollViewCustom extends ScrollView {
final slivers = buildSlivers(context);
final axisDirection = getDirection(context);

final effectivePrimary = primary ??
controller == null &&
PrimaryScrollController.shouldInherit(context, scrollDirection);

final scrollController =
primary ? PrimaryScrollController.of(context) : controller;
effectivePrimary ? PrimaryScrollController.of(context) : controller;

final scrollable = Scrollable(
key: scrollStateKey,
dragStartBehavior: dragStartBehavior,
Expand All @@ -66,7 +71,8 @@ abstract class ScrollViewCustom extends ScrollView {
return buildViewport(context, offset, axisDirection, slivers);
},
);
final scrollableResult = primary && scrollController != null
final scrollableResult = effectivePrimary && scrollController != null
// Further descendant ScrollViews will not inherit the same PrimaryScrollController
? PrimaryScrollController.none(child: scrollable)
: scrollable;

Expand Down
33 changes: 13 additions & 20 deletions pubspec.lock
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
Expand All @@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -80,28 +73,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -113,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -134,21 +127,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
vector_math:
dependency: transitive
description:
Expand All @@ -158,4 +151,4 @@ packages:
version: "2.1.2"
sdks:
dart: ">=2.17.0-206.0.dev <3.0.0"
flutter: ">=1.17.0"
flutter: ">=3.3.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ homepage: https://github.com/NamanShergill/flutter_scroll_to_top

environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
flutter: ">=3.3.0"

dependencies:
flutter:
Expand Down

0 comments on commit d9bc27e

Please sign in to comment.