gesture_handlers

Creator: coderz1093

Last updated:

0 purchases

gesture_handlers Image
gesture_handlers Images
Add to Cart

Description:

gesture handlers

Gesture handlers #




Gesture handlers Flutter project.
Provide reusable gesture handler and Support interactive transitions between routes (i.e., controlled by gesture).
Preview #


Installation #
Add gesture_handlers
as a dependency in your pubspec.yaml file.
flutter pub add gesture_handlers
copied to clipboard
Import it in your Dart code
import 'package:gesture_handlers/gesture_handlers.dart';
copied to clipboard
Usage #
Basic usage #
Initialize concrete GestureHandler implementation.
final tapHandler = TapHandlerDelegate(onTap: () => print('tap handled'));
copied to clipboard
Pass handler to GestureListener.
@override
Widget build(BuildContext context) {
return GestureListener(
handler: tapHandler,
child: Scaffold(body: Center(child: Text('Tap'))),
);
}
copied to clipboard
Dispose it at the end.
@override
void dispose() {
tapHandler.dispose();
super.dispose();
}
copied to clipboard
Route gesture transition #

Initialize NavigatorGesturesFlutterBinding
or use your own NavigatorGesturesBinding implementation
for prevent route GestureHandler active pointers canceling by NavigatorState.

import 'package:gesture_handlers/gesture_handlers.dart';

void main() {
/// Prints information about preventing cancel pointer with [GestureBinding.cancelPointer].
// debugPrintPreventCancelPointer = true;

NavigatorGesturesFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
copied to clipboard

Initialize SwipeRouteHandler or your own GestureRouteDelegate implementation.
Use GestureModalBottomSheetRoute, MaterialGesturePageRoute
or create custom gesture route with GestureRouteTransitionMixin.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.