@@ -3,7 +3,10 @@ import 'package:flutter/material.dart';
3
3
import 'package:gesture_handlers/gesture_handlers.dart' ;
4
4
5
5
void main () {
6
+ // debugPrintRecognizerCallbacksTrace = true;
6
7
// debugPrintPreventCancelPointer = true;
8
+
9
+ /// [GestureBinding] implementation for prevent route [GestureHandler] active pointers canceling by [NavigatorState] .
7
10
NavigatorGesturesFlutterBinding .ensureInitialized ();
8
11
runApp (const MyApp ());
9
12
}
@@ -40,7 +43,7 @@ class MyHomePage extends StatefulWidget {
40
43
}
41
44
42
45
class _MyHomePageState extends State <MyHomePage > with TickerProviderStateMixin {
43
- late final AnimationControllerSwipeHandler persistentBottomSwipeHandler ;
46
+ late final AnimationController persistentBottomController ;
44
47
late final SwipeRouteHandler secondSwipeHandler;
45
48
late final AnimationControllerGestureMixin horizontalSwipeHandler;
46
49
late final GestureHandler handlerComposer;
@@ -51,15 +54,16 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
51
54
52
55
double get bottomSheetHeight => 0.8 * size.height;
53
56
54
- bool get isPersistentBottomOpened => persistentBottomSwipeHandler.controller .value.round () > 0 ;
57
+ bool get isPersistentBottomOpened => persistentBottomController .value.round () > 0 ;
55
58
56
59
@override
57
60
void initState () {
58
61
super .initState ();
59
- persistentBottomSwipeHandler = AnimationControllerSwipeHandler (
62
+ persistentBottomController = AnimationController (duration: const Duration (milliseconds: 300 ), vsync: this );
63
+ final persistentBottomSwipeHandler = AnimationControllerSwipeHandler (
60
64
direction: DragDirection .vertical,
61
65
reverse: true ,
62
- controller: AnimationController (duration : const Duration (milliseconds : 300 ), vsync : this ) ,
66
+ controller: persistentBottomController ,
63
67
getChildSize: () => persistentBottomHeight,
64
68
);
65
69
secondSwipeHandler = SwipeRouteHandler (
@@ -99,9 +103,8 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
99
103
100
104
@override
101
105
void dispose () {
102
- persistentBottomSwipeHandler.controller.dispose ();
103
- secondSwipeHandler.controller.dispose ();
104
- horizontalSwipeHandler.controller.dispose ();
106
+ persistentBottomController.dispose ();
107
+ handlerComposer.dispose ();
105
108
super .dispose ();
106
109
}
107
110
@@ -126,7 +129,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
126
129
127
130
Widget buildPersistentBottom (BuildContext context) {
128
131
return SizeTransition (
129
- sizeFactor: persistentBottomSwipeHandler.controller ,
132
+ sizeFactor: persistentBottomController ,
130
133
axisAlignment: - 1.0 ,
131
134
child: Card (
132
135
margin: EdgeInsets .zero,
0 commit comments