flutter_touch_interaction_controller 1.1.0 copy "flutter_touch_interaction_controller: ^1.1.0" to clipboard
flutter_touch_interaction_controller: ^1.1.0 copied to clipboard

PlatformAndroid

A Flutter plugin to detect and handle touch events on the screen for Android device.

Flutter Touch Interaction Controller #

pub package

  • Description: A Flutter plugin to detect and handle touch events on the screen for Android device.
  • Technology stack: Flutter plugin.
  • Status: CHANGELOG.

Main Features #

  1. One-touch event recognition and stream provision.
  2. Requesting accessibilityService permission.
  3. Verifying accessibilityService permission.
  4. One-touch execution.
  5. Touch swife execution.

Screenshot: Sample screenshot of the project,

Installation #

Add dependencies #

Add the following dependency to your pubspec.yaml file:

    dependencies:
    flutter_touch_interaction_controller: ^1.1.0

Change Android settings #

  1. Add the following code after the activity section in the android/app/src/main/AndroidManifest.xml file:
<service
    android:name="com.rabbitson87.flutter_touch_interaction_controller.AccessibilityServicePlugin"
    android:exported="true"
    android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
    <intent-filter>
        <action android:name="android.accessibilityservice.AccessibilityService" />
    </intent-filter>
    <meta-data
        android:name="android.accessibilityservice"
        android:resource="@xml/accessibility_service_config" />
</service>
  1. Create android/app/src/main/res/xml/accessibility_service_config.xml file and add the following code:
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:accessibilityEventTypes="typeAllMask"
    android:accessibilityFeedbackType="feedbackSpoken"
    android:accessibilityFlags="flagDefault"
    android:canPerformGestures="true"
    android:canRequestTouchExplorationMode="true"
    android:notificationTimeout="100" />

Usage #

Check if the accessibility permission is enabled:

bool isAccessibilityPermissionEnabled = await FlutterTouchInteractionController.isAccessibilityPermissionEnabled;

Request accessibility permission:

await FlutterTouchInteractionController.requestAccessibilityPermission;

Listen to the touch events:

final accessStream = FlutterTouchInteractionController.accessStream.listen((event) {
  print(event);
});

Remove the listener when it is no longer needed:

accessStream.cancel();

Execute a touch event:

await FlutterTouchInteractionController.touch(Point(x: 350, y: 400));

Execute a swipe event:

await FlutterTouchInteractionController.swipe(Point(x: 350, y: 1400), Point(x: 350, y: 1000));

Getting help #

If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.

Getting involved #

General instructions on how to contribute should be stated with a link to CONTRIBUTING.


Open source licensing info #

  1. TERMS
  2. LICENSE

Credits and references #

  1. flutter_accessibility_service
  2. do-touch
2
likes
150
points
21
downloads

Publisher

verified publisherrabbitson87.dev

Weekly Downloads

A Flutter plugin to detect and handle touch events on the screen for Android device.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_touch_interaction_controller