forked from kyuqw/gesture_handlers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
88 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. | ||
* Initial Release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,83 @@ | ||
# gesture_handlers | ||
# Gesture handlers | ||
|
||
[](https://pub.dev/packages/gesture_handlers) | ||
[](https://pub.dev/packages/gesture_handlers) | ||
[](https://pub.dev/packages/gesture_handlers/score) | ||
[](https://pub.dev/packages/gesture_handlers) | ||
|
||
Gesture handlers Flutter project. | ||
|
||
## Getting Started | ||
Provide reusable gesture handler and Support interactive transitions between routes (i.e., controlled by gesture). | ||
|
||
## Preview | ||
|
||
[<img src="https://raw.githubusercontent.com/kyuqw/gesture_handlers/master/example/media/bottom_sheet_demo.gif" width="250" alt="bottom sheet demo"/>](https://pub.dev/packages/gesture_handlers/example) | ||
[<img src="https://raw.githubusercontent.com/kyuqw/gesture_handlers/master/example/media/right_sheet_demo.gif" width="250" alt="right sheet demo"/>](https://pub.dev/packages/gesture_handlers/example) | ||
|
||
|
||
## Installation | ||
|
||
Add [*`gesture_handlers`*](https://pub.dev/packages/gesture_handlers/install) | ||
as a dependency in [your pubspec.yaml file](https://flutter.dev/using-packages). | ||
|
||
```shell | ||
flutter pub add gesture_handlers | ||
``` | ||
Import it in your Dart code | ||
```dart | ||
import 'package:gesture_handlers/gesture_handlers.dart'; | ||
``` | ||
|
||
## Usage | ||
|
||
### Basic usage | ||
|
||
Initialize concrete `GestureHandler` implementation. | ||
|
||
```dart | ||
final tapHandler = TapHandlerDelegate(onTap: () => print('tap handled')); | ||
``` | ||
|
||
Pass handler to `GestureListener`. | ||
|
||
```dart | ||
@override | ||
Widget build(BuildContext context) { | ||
return GestureListener( | ||
handler: tapHandler, | ||
child: Scaffold(body: Center(child: Text('Tap'))), | ||
); | ||
} | ||
``` | ||
|
||
Dispose it at the end. | ||
|
||
```dart | ||
@override | ||
void dispose() { | ||
tapHandler.dispose(); | ||
super.dispose(); | ||
} | ||
``` | ||
|
||
### Route gesture transition | ||
|
||
* Initialize `NavigatorGesturesFlutterBinding` | ||
or use your own `NavigatorGesturesBinding` implementation | ||
for prevent route `GestureHandler` active pointers canceling by `NavigatorState`. | ||
|
||
```dart | ||
import 'package:gesture_handlers/gesture_handlers.dart'; | ||
void main() { | ||
/// Prints information about preventing cancel pointer with [GestureBinding.cancelPointer]. | ||
// debugPrintPreventCancelPointer = true; | ||
This project is a starting point for a Dart | ||
[package](https://flutter.dev/developing-packages/), | ||
a library module containing code that can be shared easily across | ||
multiple Flutter or Dart projects. | ||
NavigatorGesturesFlutterBinding.ensureInitialized(); | ||
runApp(const MyApp()); | ||
} | ||
``` | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
* Initialize `SwipeRouteHandler` or your own `GestureRouteDelegate` implementation. | ||
* Use `GestureModalBottomSheetRoute`, `MaterialGesturePageRoute` | ||
or create custom gesture route with `GestureRouteTransitionMixin`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters