From 9ed335f642b0311998125b8943114d340b811b59 Mon Sep 17 00:00:00 2001 From: Riccardo Cucia Date: Tue, 14 Jan 2025 08:45:14 +0100 Subject: [PATCH] Fixed shadow display bug with Scroll reverse to true - (#16) (#17) ## [1.2.5] - 2024-01-14 #### [@rickypid](https://github.com/rickypid) - Fixed shadow display bug with Scroll reverse to true - (#16) --- .github/workflows/flutter.yml | 20 ++++---- CHANGELOG.md | 4 ++ example/pubspec.lock | 89 ++++++++++++++++++++++------------- lib/src/scroll_shadow.dart | 10 +++- pubspec.lock | 75 +++++++++++++++++++---------- pubspec.yaml | 6 +-- test/both_axis_test.dart | 11 +++-- 7 files changed, 139 insertions(+), 76 deletions(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 55f498b..3884a55 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -1,26 +1,28 @@ -name: Flutter +name: Flutter analyze on: - push: - branches: [ "master" ] pull_request: - branches: [ "master" ] + branches: [main, dev] jobs: - build: + flutter-analyze: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 + - uses: actions/checkout@v2 + + - name: Setup Flutter environment + uses: subosito/flutter-action@v2 with: channel: 'stable' - name: Install dependencies run: flutter pub get + - name: Analyze formatting + run: dart format . --set-exit-if-changed + - name: Analyze project source - run: dart analyze + run: dart analyze --no-pub - name: Install pana run: dart pub global activate pana diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d7e3ac..67127a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Flutter Scroll Shadow +## [1.2.5] - 2024-01-14 +#### [@rickypid](https://github.com/rickypid) +- Fixed shadow display bug with Scroll reverse to true - (#16) + ## [1.2.4] - 2024-01-08 #### [@pixelshot91](https://github.com/pixelshot91) - Enable to nest mulitple ScrollShadow without the inner one interfering with the outer one diff --git a/example/pubspec.lock b/example/pubspec.lock index 9e4c904..308dda0 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: args - sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.6.0" async: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" fake_async: dependency: transitive description: @@ -66,17 +66,17 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" flutter_scroll_shadow: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.2.2" + version: "1.2.5" flutter_test: dependency: "direct dev" description: flutter @@ -90,46 +90,70 @@ packages: url: "https://pub.dev" source: hosted version: "4.6.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.1" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -147,18 +171,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -179,18 +203,18 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" tint: dependency: transitive description: name: tint - sha256: d856019547532d4ea24171f554b319081c004c37741e7946eae30cb09f24e1c7 + sha256: "9652d9a589f4536d5e392cf790263d120474f15da3cf1bee7f1fdb31b4de5f46" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" vector_math: dependency: transitive description: @@ -199,21 +223,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "14.2.5" yaml: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/lib/src/scroll_shadow.dart b/lib/src/scroll_shadow.dart index 49f4aa2..e4ec66b 100644 --- a/lib/src/scroll_shadow.dart +++ b/lib/src/scroll_shadow.dart @@ -188,8 +188,14 @@ class _ScrollShadowState extends State { if (_axis != metrics.axis) { setState(() => _axis = metrics.axis); } - reachedStart = metrics.pixels <= metrics.minScrollExtent; - reachedEnd = metrics.pixels >= metrics.maxScrollExtent; + final bool isReverse = metrics.axisDirection == AxisDirection.left || + metrics.axisDirection == AxisDirection.up; + reachedStart = isReverse + ? metrics.pixels >= metrics.maxScrollExtent + : metrics.pixels <= metrics.minScrollExtent; + reachedEnd = isReverse + ? metrics.pixels <= metrics.minScrollExtent + : metrics.pixels >= metrics.maxScrollExtent; _animate = true; // Consume the notification to prevent possible ScrollShadow ancestor to interpret them a second timme return true; diff --git a/pubspec.lock b/pubspec.lock index 7013c69..2ad979b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: "direct dev" description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" fake_async: dependency: transitive description: @@ -58,55 +58,79 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "5.0.0" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -124,18 +148,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -156,10 +180,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" vector_math: dependency: transitive description: @@ -168,13 +192,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "14.2.5" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index e147565..4c81aaf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_scroll_shadow description: ScrollShadow adds shadows to a scrollable child. Supports ScrollController and vertical or horizontal orientation. -version: 1.2.4 +version: 1.2.5 repository: https://github.com/rickypid/flutter_scroll_shadow issue_tracker: https://github.com/rickypid/flutter_scroll_shadow/issues homepage: https://github.com/rickypid/flutter_scroll_shadow @@ -15,9 +15,9 @@ dependencies: sdk: flutter dev_dependencies: - flutter_lints: ^2.0.2 + flutter_lints: ^5.0.0 flutter_test: sdk: flutter - collection: ^1.17.2 + collection: ^1.18.0 flutter: null \ No newline at end of file diff --git a/test/both_axis_test.dart b/test/both_axis_test.dart index dade0ce..5a37a48 100644 --- a/test/both_axis_test.dart +++ b/test/both_axis_test.dart @@ -24,7 +24,8 @@ class _BothAxisShadow extends StatelessWidget { child: ScrollShadow( size: _verticalShadowSize, color: _verticalShadowColor, - child: ListView.builder(itemBuilder: (context, rowIndex) => _MyRow(rowIndex))), + child: ListView.builder( + itemBuilder: (context, rowIndex) => _MyRow(rowIndex))), ), ), )); @@ -104,11 +105,11 @@ AnimatedOpacity _findVerticalShadow(_Direction direction) { expect(gradient.begin, Alignment.bottomCenter); expect(gradient.end, Alignment.topCenter); - if (const ListEquality() - .equals(gradient.colors, [_verticalShadowColor.withOpacity(0), _verticalShadowColor])) { + if (const ListEquality().equals(gradient.colors, + [_verticalShadowColor.withOpacity(0), _verticalShadowColor])) { return direction == _Direction.start; - } else if (const ListEquality() - .equals(gradient.colors, [_verticalShadowColor, _verticalShadowColor.withOpacity(0)])) { + } else if (const ListEquality().equals(gradient.colors, + [_verticalShadowColor, _verticalShadowColor.withOpacity(0)])) { return direction == _Direction.end; } else { fail('The gradient colors should be one of the above');