Giter VIP home page Giter VIP logo

cupertino_back_gesture's People

Contributors

pin73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cupertino_back_gesture's Issues

This library cannot use with WillPopScope

Hi Author.
With TargetPlatform.android:
CupertinoPageTransitionsBuilderCustomBackGestureWidth()
In OtherPage, I use WillPopScope to catch back event of Android then this library is not working.

Thank you.

extends MaterialPageRoute does not work

class AnimationPageRoute<T> extends MaterialPageRoute<T> {
  AnimationPageRoute({
    WidgetBuilder builder,
    RouteSettings settings,
    this.isExitPageAffectedOrNot = true,
    this.animationType = AnimationType.SlideRL,
    this.maintainState = true,
  }) : super(builder: builder, settings: settings);

  // AnimationPageRoute({
  //   @required this.builder,
  //   this.isExitPageAffectedOrNot = true,
  //   this.animationType = AnimationType.SlideRL,
  //   RouteSettings settings,
  //   this.maintainState = true,
  //   bool fullscreenDialog = false,
  // })  : assert(builder != null),
  //       assert(isExitPageAffectedOrNot != null),
  //       assert(animationType != null),
  //       assert(maintainState != null),
  //       assert(fullscreenDialog != null);

  // final WidgetBuilder builder;

  /// 该参数只针对当[AnimationType][SlideLR][SlideRL]新页面及当前页面动画均有效
  final bool isExitPageAffectedOrNot;

  final AnimationType animationType;

  @override
  final bool maintainState;

  @override
  Duration get transitionDuration => const Duration(milliseconds: 1000);

  @override
  Color get barrierColor => null;

  @override
  String get barrierLabel => null;

  @override
  bool canTransitionTo(TransitionRoute<dynamic> nextRoute) =>
      nextRoute is AnimationPageRoute && !nextRoute.fullscreenDialog;

  @override
  Widget buildPage(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation) {
    final Widget result = builder(context);
    assert(() {
      if (result == null) {
        throw FlutterError.fromParts(<DiagnosticsNode>[
          ErrorSummary(
              'The builder for route "${settings.name}" returned null.'),
          ErrorDescription('Route builders must never return null.')
        ]);
      }
      return true;
    }());
    return Semantics(
        scopesRoute: true, explicitChildNodes: true, child: result);
  }

  @override
  Widget buildTransitions(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation, Widget child) {
    if (animationType == AnimationType.Fade)
      FadeTransition(
          opacity: CurvedAnimation(
            parent: animation,
            curve: Curves.linearToEaseOut,
            reverseCurve: Curves.easeInToLinear,
          ).drive(_tweenFade),
          child: child);
    final TextDirection textDirection = Directionality.of(context);
    Tween<Offset> primaryTween = _primaryTweenSlideFromRightToLeft,
        secondTween = _secondaryTweenSlideFromRightToLeft;
    Cubic curve = Curves.linearToEaseOut, reverseCurve = Curves.easeInToLinear;
    if (animationType == AnimationType.SlideBT) {
      primaryTween = _primaryTweenSlideFromBottomToTop;
    } else if (animationType == AnimationType.SlideTB) {
      primaryTween = _primaryTweenSlideFromTopToBottom;
    } else if (animationType == AnimationType.SlideLR) {
      primaryTween = _primaryTweenSlideFromLeftToRight;
      secondTween = _secondaryTweenSlideFromLeftToRight;
      curve = Curves.fastOutSlowIn;
      reverseCurve = Curves.easeOutCubic;
    }
    Widget enterAnimWidget = SlideTransition(
        position: CurvedAnimation(
          parent: animation,
          curve: curve,
          reverseCurve: reverseCurve,
        ).drive(primaryTween),
        textDirection: textDirection,
        child: child);
    if (isExitPageAffectedOrNot != true ||
        ([AnimationType.SlideTB, AnimationType.SlideBT]
            .contains(animationType))) return enterAnimWidget;
    return SlideTransition(
        position: CurvedAnimation(
          parent: secondaryAnimation,
          curve: curve,
          reverseCurve: reverseCurve,
        ).drive(secondTween),
        textDirection: textDirection,
        child: enterAnimWidget);
  }

  @override
  String get debugLabel => '${super.debugLabel}(${settings.name})';
}

Error

I got this issue

`../../../../documents/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_back_gesture-0.0.3/lib/src/cupertino_page_route.dart:120:15: Error: Getter not found: 'opaque'.
assert(opaque),
^^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/uogforceone/documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 900

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/uogforceone/documents/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org
    `

Is it only for material app?

Thanks for your plugin. I tried to add it, but looks like it's only for MaterialApp, because I can't set pageTransitionsTheme in CupertinoApp.

Is there a way to use it with CupertinoApp?

No license

Hi, could you please clarify the license of this code? Can it be used in commercial products?

Allow the back gesture to not override any other gesture that is not in the same direction

Basically I have a bunch of dismissible views, but when I use this plugin with the whole page set as the swipe back gesture, I am unable to dismiss my views in the other direction. Would it be possible to make it so that the gesture does not override these (meaning the right to left gesture) and only the left to right gesture?

Thank you! Love the plugin btw

Is there a way to change the dismiss/pop animation

I want to pop the current route by dragging down. So the current route should move along with the finger towards the bottom of the page while fading out and shrinking.

Basically I would like to know if there is an easy way, without forking the package, to customize the dismiss animation and gesture.

My objective is to have a similar UX to a Instagram Story route pop.

Thank you very much.

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.