Giter VIP home page Giter VIP logo

Comments (3)

emvaized avatar emvaized commented on July 17, 2024

I guess you should implement your own GestureArena, like described in this article:
https://medium.com/koahealth/combining-multiple-gesturedetectors-in-flutter-26d899d008b2

from cupertino_back_gesture.

SteveJob avatar SteveJob commented on July 17, 2024

It is conflict with TabBar&TabBarView。
It is conflict with ListView( scrollDirection : Axis.horizontal)。

Has the problem been solved now?

from cupertino_back_gesture.

ivanbogomoloff avatar ivanbogomoloff commented on July 17, 2024

Workaround is RawGestureDetector with hardcoded swipe zone.

child: RawGestureDetector(
                        gestures: {
                          AllowMultipleGestureRecognizer:
                          GestureRecognizerFactoryWithHandlers<
                              AllowMultipleGestureRecognizer>(
                                () => AllowMultipleGestureRecognizer(),  //constructor
                                (AllowMultipleGestureRecognizer instance) {

                              instance.onCancel = () {
                                setState(() {
                                  _tabPhysics = const ScrollPhysics();
                                });
                              };
                              instance.onDown = (position) {
                                setState(() {
                                  /// 199 - it's magic left side zone on screen. I think it can be about 200-250 in my case it's ok.
                                  if(_tabController!.index == 0 && position.localPosition.dx <= 199) {
                                      _tabPhysics = const NeverScrollableScrollPhysics();
                                  } else {
                                    _tabPhysics = const ScrollPhysics();
                                  }
                                });
                              };
                            },
                          )
                        },
                      child: TabBarView(
                        physics: _tabPhysics,
                        controller: _tabController,
                        children: tabs.map((tab) => AdvertListWidget(items: tab.items)).toList(),
                      ),
                    )
//
class AllowMultipleGestureRecognizer extends VerticalDragGestureRecognizer
{
  @override
  void rejectGesture(int pointer) {

    acceptGesture(pointer);
  }
}

And in _tabController i change physics

_tabController!.addListener(() {
   setState(() {
      _tabPhysics = const ScrollPhysics();
    });
});

from cupertino_back_gesture.

Related Issues (13)

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.