pdliuw / airoute

*1、Support routing management without context *2、Support 'non-intrusive parameter passing' routing management *3、Airoute that makes you fall in love with routing management

Home Page:https://flutter-app-sample.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getting error on using pushNamedWithAnimation

pishguy opened this issue · comments

when i pull your repository and try to test i get this error on clicking on main page with optional options;

MaterialButton(
  onPressed: () {
    Airoute.pushNamedWithAnimation(
        routeName: "/SecondPage",
        argument: "遇见你,我很开心😄😄😄",
        routePageAnimation: AirouteTransition.Slide);
  },
  color: Theme.of(context).primaryColor,
  textColor: Colors.white,
  child: Text("跳转下一页"),
),

error


════════ Exception caught by gesture ══════
The following assertion was thrown while handling a gesture:
'package:flutter/src/widgets/routes.dart': Failed assertion: line 130 pos 12: 'duration != null && duration >= Duration.zero': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=BUG.md

When the exception was thrown, this was the stack: 
#2      TransitionRoute.createAnimationController (package:flutter/src/widgets/routes.dart:130:12)
#3      PageRoute.createAnimationController (package:flutter/src/widgets/pages.dart:40:50)
#4      TransitionRoute.install (package:flutter/src/widgets/routes.dart:177:19)
#5      ModalRoute.install (package:flutter/src/widgets/routes.dart:959:11)
#6      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1791:11)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#2bcf9
  debugOwner: GestureDetector
  state: possible
  won arena
  finalPosition: Offset(195.3, 421.0)
  finalLocalPosition: Offset(61.3, 22.0)
  button: 1
  sent tap down
═══════════════════════════════════════════════
commented

**Solution:

duration: Duration(milliseconds: 500),

**Full code sample:

MaterialButton(
onPressed: () {
Airoute.pushNamedWithAnimation(
routeName: "/SecondPage",
argument: "$_content \n 遇见你,我很开心😄😄😄",
routePageAnimation: AirouteTransition.Slide,
duration: Duration(milliseconds: 500),
);
},
color: Theme.of(context).primaryColor,
textColor: Colors.white,
child: Text("跳转下一页"),
),

commented

【next version】Thank you very much for your feedback, we will provide a default duration for the animation!

commented

The latest version has fixed this problem [provide a default duration for the animation]

commented

[0.1.7] - Route.
Fix: something!
1 、Duration

Error:Failed assertion: line 130 pos 12: 'duration != null && duration >= Duration.zero': is not true. Issues:#3