diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..0f3d989 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/developer/development/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/developer/flutter_page_transition/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/pubspec.lock b/example/pubspec.lock index 99c482e..ac4efb1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,83 +1,125 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "31.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.36.4" + version: "2.8.0" + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.6" args: dependency: transitive description: name: args - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "2.3.0" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.3.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" convert: dependency: transitive description: name: convert - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "3.0.1" + coverage: dependency: transitive description: - name: crypto - url: "https://pub.flutter-io.cn" + name: coverage + url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" - csslib: + version: "1.0.3" + crypto: dependency: transitive description: - name: csslib - url: "https://pub.flutter-io.cn" + name: crypto + url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "3.0.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" file: dependency: transitive description: name: file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "5.0.8" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -92,21 +134,21 @@ packages: dependency: "direct main" description: name: flutter_page_transition - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.1.6" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" - front_end: + frontend_server_client: dependency: transitive description: - name: front_end - url: "https://pub.flutter-io.cn" + name: frontend_server_client + url: "https://pub.dartlang.org" source: hosted - version: "0.1.19" + version: "2.1.2" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -116,198 +158,149 @@ packages: dependency: transitive description: name: glob - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.14.0+2" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.0+2" + version: "2.0.2" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.1.3" - intl: - dependency: transitive - description: - name: intl - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.15.8" + version: "4.0.0" io: dependency: transitive description: name: io - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" - json_rpc_2: + version: "0.6.3" + logging: dependency: transitive description: - name: json_rpc_2 - url: "https://pub.flutter-io.cn" + name: logging + url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.19" + version: "1.0.2" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.11" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.7.0" mime: dependency: transitive description: name: mime - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.9.6+3" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.1" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "2.0.1" package_config: dependency: transitive description: name: package_config - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.5" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.10" + version: "2.0.2" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "1.8.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.11.1" platform: dependency: transitive description: name: platform - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "3.0.2" pool: dependency: transitive description: name: pool - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0" process: dependency: transitive description: name: process - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.9" + version: "4.2.4" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.4.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.1.0" shelf: dependency: transitive description: name: shelf - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.7.5" + version: "1.2.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.1.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" sky_engine: dependency: transitive description: flutter @@ -317,113 +310,134 @@ packages: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.10.8" + version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" + sync_http: + dependency: transitive + description: + name: sync_http + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test: dependency: "direct dev" description: name: test - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.6.3" + version: "1.17.12" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.4.3" test_core: dependency: transitive description: name: test_core - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.4.2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - vm_service_client: + version: "2.1.1" + vm_service: dependency: transitive description: - name: vm_service_client - url: "https://pub.flutter-io.cn" + name: vm_service + url: "https://pub.dartlang.org" source: hosted - version: "0.2.6+2" + version: "7.3.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+12" + version: "1.0.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + webdriver: + dependency: transitive + description: + name: webdriver + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + url: "https://pub.dartlang.org" source: hosted - version: "1.0.13" + version: "1.0.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.16" + version: "3.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.14.0 <3.0.0" diff --git a/lib/flutter_page_transition.dart b/lib/flutter_page_transition.dart index ab6049a..909f5d1 100644 --- a/lib/flutter_page_transition.dart +++ b/lib/flutter_page_transition.dart @@ -11,32 +11,25 @@ TransitionEffect transitionEffect = TransitionEffect(); final Map effectMap = { PageTransitionType.custom: transitionEffect.customEffect, - PageTransitionType.fadeIn: TransitionEffect.createFadeIn(), - PageTransitionType.transferRight: TransitionEffect.createTransfer(animationTween: t1, secondaryAnimationTween: t5, animationScaleTween: t14, secondaryAnimationScaleTween: t13), PageTransitionType.transferUp: TransitionEffect.createTransfer(animationTween: t3, secondaryAnimationTween: t7, animationScaleTween: t14, secondaryAnimationScaleTween: t13), - PageTransitionType.slideInLeft: TransitionEffect.createSlideIn(t1), PageTransitionType.slideInRight: TransitionEffect.createSlideIn(t2), PageTransitionType.slideInUp: TransitionEffect.createSlideIn(t3), PageTransitionType.slideInDown: TransitionEffect.createSlideIn(t4), - PageTransitionType.slideLeft: TransitionEffect.createSlide(animationTween: t1, secondaryAnimationTween: t5), PageTransitionType.slideRight: TransitionEffect.createSlide(animationTween: t2, secondaryAnimationTween: t6), PageTransitionType.slideUp: TransitionEffect.createSlide(animationTween: t3, secondaryAnimationTween: t7), PageTransitionType.slideDown: TransitionEffect.createSlide(animationTween: t4, secondaryAnimationTween: t8), - PageTransitionType.slideParallaxLeft: TransitionEffect.createSlide(animationTween: t1, secondaryAnimationTween: t9), PageTransitionType.slideParallaxRight: TransitionEffect.createSlide(animationTween: t2, secondaryAnimationTween: t10), PageTransitionType.slideParallaxUp: TransitionEffect.createSlide(animationTween: t3, secondaryAnimationTween: t11), PageTransitionType.slideParallaxDown: TransitionEffect.createSlide(animationTween: t4, secondaryAnimationTween: t12), - PageTransitionType.slideZoomLeft: TransitionEffect.createZoomSlide(animationTween: t1, secondaryAnimationTween: t13), PageTransitionType.slideZoomRight: TransitionEffect.createZoomSlide(animationTween: t2, secondaryAnimationTween: t13), PageTransitionType.slideZoomUp: TransitionEffect.createZoomSlide(animationTween: t3, secondaryAnimationTween: t13), PageTransitionType.slideZoomDown: TransitionEffect.createZoomSlide(animationTween: t4, secondaryAnimationTween: t13), - PageTransitionType.rippleRightUp: TransitionEffect.createRipple(origin: 'Right'), PageTransitionType.rippleLeftUp: TransitionEffect.createRipple(origin: 'Left'), PageTransitionType.rippleLeftDown: TransitionEffect.createRipple(origin: 'LeftDown'), @@ -52,24 +45,18 @@ class PageTransition extends PageRouteBuilder { final Duration duration; PageTransition({ - Key key, - @required this.child, - @required this.type, + Key? key, + required this.child, + required this.type, this.curve = Curves.linear, - this.alignment, + this.alignment = Alignment.center, this.duration = const Duration(milliseconds: 200), }) : super( - pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) { - return child; - }, - transitionDuration: duration, - transitionsBuilder: ( - BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child - ) { - - return effectMap[type](curve, animation, secondaryAnimation, child); - }); + pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) { + return child; + }, + transitionDuration: duration, + transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { + return effectMap[type](curve, animation, secondaryAnimation, child); + }); } diff --git a/lib/transition_effect.dart b/lib/transition_effect.dart index 751382d..59cf02e 100644 --- a/lib/transition_effect.dart +++ b/lib/transition_effect.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'dart:math'; class RippleClipper extends CustomClipper { - RippleClipper({this.origin, this.progress}); + RippleClipper({required this.origin, required this.progress}); final String origin; final double progress; @@ -26,7 +26,7 @@ class RippleClipper extends CustomClipper { } class TransitionEffect { - Function _customEffect; + late Function _customEffect; TransitionEffect() { _customEffect = (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) { @@ -36,7 +36,7 @@ class TransitionEffect { get customEffect => _customEffect; - createCustomEffect({Function handle}) { + createCustomEffect({required Function handle}) { _customEffect = handle; } @@ -44,15 +44,15 @@ class TransitionEffect { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) => new FadeTransition(opacity: animation, child: child); } - static createTransfer({Tween animationTween, Tween secondaryAnimationTween, Tween animationScaleTween, Tween secondaryAnimationScaleTween}) { + static createTransfer({required Tween animationTween, required Tween secondaryAnimationTween, required Tween animationScaleTween, required Tween secondaryAnimationScaleTween}) { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) { // 进入动效 Widget secondaryPage = new SlideTransition( - position: secondaryAnimationTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.3, 0.7, curve: curve))), + position: secondaryAnimationTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.3, 0.7, curve: curve))) as Animation, child: new ScaleTransition( - scale: secondaryAnimationScaleTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.0, 0.3, curve: curve))), + scale: secondaryAnimationScaleTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.0, 0.3, curve: curve))) as Animation, child: new ScaleTransition( - scale: secondaryAnimationScaleTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.7, 1.0, curve: curve))), + scale: secondaryAnimationScaleTween.animate(CurvedAnimation(parent: secondaryAnimation, curve: Interval(0.7, 1.0, curve: curve))) as Animation, child: child, ), ), @@ -60,11 +60,11 @@ class TransitionEffect { // 离开动效 return new SlideTransition( - position: animationTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.3, 0.7, curve: curve))), + position: animationTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.3, 0.7, curve: curve))) as Animation, child: new ScaleTransition( - scale: animationScaleTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.0, 0.3, curve: curve))), + scale: animationScaleTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.0, 0.3, curve: curve))) as Animation, child: new ScaleTransition( - scale: animationScaleTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.7, 1.0, curve: curve))), + scale: animationScaleTween.animate(CurvedAnimation(parent: animation, curve: Interval(0.7, 1.0, curve: curve))) as Animation, child: secondaryPage, ), ), @@ -74,36 +74,35 @@ class TransitionEffect { static createSlideIn(Tween tween) { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) => new SlideTransition( - position: tween.animate(CurvedAnimation(parent: animation, curve: curve)), - child: child, - ); + position: tween.animate(CurvedAnimation(parent: animation, curve: curve)) as Animation, + child: child, + ); } - static createSlide({Tween animationTween, Tween secondaryAnimationTween}) { + static createSlide({required Tween animationTween, required Tween secondaryAnimationTween}) { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) => new SlideTransition( - position: animationTween.animate(animation), - child: new SlideTransition( - position: secondaryAnimationTween.animate(secondaryAnimation), - child: child, - ), - ); + position: animationTween.animate(animation) as Animation, + child: new SlideTransition( + position: secondaryAnimationTween.animate(secondaryAnimation) as Animation, + child: child, + ), + ); } - static createZoomSlide({Tween animationTween, Tween secondaryAnimationTween}) { + static createZoomSlide({required Tween animationTween, required Tween secondaryAnimationTween}) { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) => new SlideTransition( - position: animationTween.animate(animation), - child: new ScaleTransition( - scale: secondaryAnimationTween.animate(secondaryAnimation), - child: child, - ), - ); + position: animationTween.animate(animation) as Animation, + child: new ScaleTransition( + scale: secondaryAnimationTween.animate(secondaryAnimation) as Animation, + child: child, + ), + ); } - static createRipple({String origin}) { + static createRipple({required String origin}) { return (Curve curve, Animation animation, Animation secondaryAnimation, Widget child) => new ClipPath( - clipper: RippleClipper(origin: origin, progress: animation.value), - child: child, - ); + clipper: RippleClipper(origin: origin, progress: animation.value), + child: child, + ); } - -} \ No newline at end of file +} diff --git a/pubspec.lock b/pubspec.lock index 5309463..b735f5b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,30 +5,51 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -43,37 +64,23 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.11" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.7.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.7.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -83,57 +90,57 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.4.3" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.15.1 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2f94965..d68f4c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: flutter_page_transition description: A rich, convenient, easy-to-use flutter page transition package. -version: 0.1.6 +version: 1.0.0 author: handoing homepage: https://github.com/handoing/flutter_page_transition environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.15.1 <3.0.0" dependencies: flutter: diff --git a/test/transition_test.dart b/test/transition_test.dart index 103168f..3a8e9f6 100644 --- a/test/transition_test.dart +++ b/test/transition_test.dart @@ -3,9 +3,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_page_transition/flutter_page_transition.dart'; void main() { - testWidgets('Create route and push other page', (WidgetTester tester) async { - await tester.pumpWidget(MyApp()); expect(find.text('Home'), findsOneWidget); @@ -15,14 +13,13 @@ void main() { await tester.pumpAndSettle(); expect(find.text('Other'), findsOneWidget); - }); } class HomePage extends StatelessWidget { static const String tag = 'home-page'; - HomePage({Key key}) : super(key: key); + HomePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -48,7 +45,7 @@ class HomePage extends StatelessWidget { class OtherPage extends StatelessWidget { static const String tag = 'other-page'; - OtherPage({Key key}) : super(key: key); + OtherPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -72,7 +69,7 @@ class OtherPage extends StatelessWidget { } class MyApp extends StatelessWidget { - MyApp({Key key}) : super(key: key); + MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -82,26 +79,23 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.blue, ), initialRoute: HomePage.tag, - onGenerateRoute: (RouteSettings routeSettings){ + onGenerateRoute: (RouteSettings routeSettings) { return new PageRouteBuilder( settings: routeSettings, pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) { - switch (routeSettings.name){ + switch (routeSettings.name) { case HomePage.tag: return HomePage(); case OtherPage.tag: return OtherPage(); default: - return null; + return HomePage(); } }, transitionDuration: const Duration(milliseconds: 600), - transitionsBuilder: (BuildContext context, Animation animation, - Animation secondaryAnimation, Widget child) { + transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { return effectMap[PageTransitionType.slideInLeft](Curves.linear, animation, secondaryAnimation, child); - } - ); - } - ); + }); + }); } }