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.

example/lib/main.dart

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

void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
      ),
      home: const ExamplePage(),
    );
  }
}

class ExamplePage extends StatefulWidget {
  const ExamplePage({super.key});

  @override
  State<ExamplePage> createState() => _ExamplePageState();
}

class _ExamplePageState extends State<ExamplePage> {
  String _input = '';
  int _matchCount = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Morse Gesture Detector')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            MorseGestureDetector(
              pattern: '..-.-',
              onInputChanged: (value) => setState(() => _input = value),
              onMatched: () {
                setState(() => _matchCount += 1);
                ScaffoldMessenger.of(context).showSnackBar(
                  const SnackBar(content: Text('숨겨진 동작을 실행했습니다.')),
                );
              },
              child: DecoratedBox(
                decoration: BoxDecoration(
                  color: Theme.of(context).colorScheme.primaryContainer,
                  borderRadius: BorderRadius.circular(24),
                ),
                child: const SizedBox(
                  width: 220,
                  height: 220,
                  child: Center(
                    child: Text(
                      '이 영역을 눌러 보세요\n..-.-',
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ),
            ),
            const SizedBox(height: 24),
            Text('현재 입력: ${_input.isEmpty ? '(없음)' : _input}'),
            Text('성공 횟수: $_matchCount'),
          ],
        ),
      ),
    );
  }
}
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