【问题标题】:Swipe up to navigate to home screen in flutter向上滑动以导航到主屏幕
【发布时间】:2019-02-21 22:26:16
【问题描述】:

我们希望在 Flutter 应用程序中实现“向上滑动”功能以导航到我们的主屏幕,我们正在考虑在所有屏幕的底部设置一条水平线来指示它在那里。我不确定如何为此功能实现手势检测器。

我有这段代码,它有时可以工作,但我认为我的容器需要更大才能读取滑动。我正在使用这个包:“swipedetector 1.2.0”。

在模拟器模式下用鼠标滑动它并不经常工作,但在我的 Surface 平板电脑模式下它工作得很好。有没有更好的方法来做到这一点?

SwipeDetector(
         onSwipeUp: () {
           setState(() {

           });
           Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) => new MemberProfile())
            ); },
         child: Container(
             margin: EdgeInsets.only(left: 30.0,top: 100.0, bottom: 30.0, right:30.0),
              child: Row(
             mainAxisAlignment: MainAxisAlignment.end,
               children: <Widget> [ 
                 Text('HELLO SWIPE ME....'),

【问题讨论】:

    标签: flutter dart navigation gesture swipe-gesture


    【解决方案1】:

    我认为您使用的库对默认滑动的速度有一些限制。但是你可能甚至不需要这个库。在我的应用中,我使用这个:

    GestureDetector(
          onVerticalDragUpdate: (dragUpdateDetails) {
            Navigator.of(context).pop();
          },
    

    【讨论】:

      猜你喜欢
      • 2015-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多