Git Product home page Git Product logo

scroll_master's Introduction

scroll_master

An example showing how to handle common scrolling gesture conflicts in Flutter.

中文文档请戳这里

🌍 Preview

Web demo 👉 Click Here

🐛 Problems

Case 1: NestedScrollView with pinned and stretch SliverAppBar

Problem: NestedScrollView does not support over-scrolling of external ListView, so its SliverAppBar cannot be stretched.

Related issue: flutter/flutter#54059

Case 2: TabBarView with horizontal ListView

Problem: TabBarView does't scroll when the internal ListView is over-scrolled.

⚡️ Solutions

For case 1: NestedScrollView with pinned and stretch SliverAppBar

Override the applyUserOffset method of _NestedScrollCoordinator to allow over-scroll the top of _outerPosition.

Override the unnestOffset, nestOffset, _getMetrics methods of _NestedScrollCoordinator to fix the mapping between _innerPosition and _outerPosition to _NestedScrollPosition (Coordinator).

For more information, see:

  • lib/pages/nested_scroll_tab_list_page.dart
  • lib/widgets/nested_scroll_view_x/src/nested_scroll_view_x.dart

For case 2: TabBarView with horizontal ListView

Reference ExtendedTabBarView to implement a TabScrollView with a ScrollController bound to it.

When the internal ListView over-scrolls, the over-scroll amount is applied to the external scrollable ExtendedTabBarView.

For more information, see:

  • lib/pages/horizontal_scroll_tab_list_page.dart
  • lib/widgets/tab_bar_view_x/src/tab_scroll_view.dart

❤️ Acknowledgements

Thanks to fluttercandies's extended_tabs and extended_nested_scroll_view.

📖 References

scroll_master's People

Contributors

idootop avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.