morse_gesture_detector 0.0.9 copy "morse_gesture_detector: ^0.0.9" to clipboard
morse_gesture_detector: ^0.0.9 copied to clipboard

A lightweight Flutter widget that triggers callbacks from custom Morse-style short and long touch patterns.

morse_gesture_detector #

A Flutter widget that triggers hidden actions through short and long presses on a specific area of the screen.

A short press is recorded as ., while a long press is recorded as -. Once the configured sequence is completed, the callback runs once. It can be useful for admin menus, QA entry points, review logins, and other actions that should not be exposed as visible buttons.

Installation #

Add the package to your pubspec.yaml:

dependencies:
  morse_gesture_detector: ^0.0.1

Usage #

Wrap an existing widget with MorseGestureDetector:

import 'package:flutter/material.dart';
import 'package:morse_gesture_detector/morse_gesture_detector.dart';

MorseGestureDetector(
  pattern: '..-.-',
  onMatched: () async {
    await openReviewLogin();
  },
  child: const AppLogo(),
)

The pattern can contain only . and -. Whitespace is ignored, so patterns can be grouped for readability:

MorseGestureDetector(
  pattern: '... --- ...',
  onMatched: showEmergencyMenu,
  child: const SizedBox(
    width: 120,
    height: 120,
    child: FlutterLogo(),
  ),
)

By default, a press shorter than 500 milliseconds is treated as a dot, and a press held for at least 500 milliseconds is treated as a dash. An incomplete sequence is cleared when no new input is received for 3 seconds.

MorseGestureDetector(
  pattern: '.--.',
  dashThreshold: const Duration(milliseconds: 650),
  sequenceTimeout: const Duration(seconds: 5),
  onInputChanged: (value) {
    debugPrint('Current input: $value');
  },
  onSequenceReset: (reason) {
    debugPrint('Reset reason: $reason');
  },
  onMatched: openAdminPage,
  child: const SettingsHeader(),
)

Existing tap and scroll gestures on the wrapped child continue to work. Use enabled: false when Morse gesture detection needs to be temporarily disabled.

See example/lib/main.dart for a complete runnable example.

0
likes
155
points
10
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter widget that triggers callbacks from custom Morse-style short and long touch patterns.

Homepage
Repository (GitHub)
View/report issues

Topics

#flutter #gesture #morse

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on morse_gesture_detector