パッケージ、リポジトリ、アプリカテゴリを検索

in_app_idle_detector のカバー
パッケージ詳細v0.0.1

in_app_idle_detector

すべてのプラットフォームでユーザーの非活性(アイドル)を検出するためのFlutterプラグイン。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
174
いいね数
6
Pub ポイント
150

パッケージをインストール

flutter pub add in_app_idle_detector

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

in_app_idle_detector パッケージは、Android、iOS、Web、macOS、Windows、Linux でユーザーの非活動状態(アイドル状態)を検出するクロスプラットフォームの Flutter プラグインです。タッチ、マウスの動き、キーボード入力などのユーザー操作を監視し、指定された期間にわたりユーザーが非活動状態であるかどうかを判断します。これにより、開発者は画面タイムアウト、セッションの有効期限切れ、自動ログアウトなどのアクションをトリガーできます。このプラグインは軽量であり、ネイティブコードの変更なしに既存の Flutter アプリケーションにシームレスに統合可能です。

用途

  • 自動セッションタイムアウト
  • ユーザー活動の追跡
  • アイドル画面ロック
  • 不正なアクセスを防ぐ
  • 非活動後に自動ログアウト

主な機能

  • クロスプラットフォーム対応
  • リアルタイムのアイドル検出
  • 設定可能なアイドル期間
  • ネイティブコードは不要です
  • シンプルな API インテグレーション

適している対象

  • セキュリティに敏感なアプリ
  • 時間ベースのセッション管理
  • キオスクまたはパブリックターミナルアプリ
  • ユーザー参加度のモニタリングを必要とするアプリ

注意事項

  • 長時間実行されるアプリでは、わずかなバッテリー消費が発生する可能性があります
  • 一部のプラットフォームでは権限が必要です
  • プラットフォームによって動作がわずかに異なる場合があります
  • 高精度のタイミング要件には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Pub Version License Platform

💤 in_app_idle_detector

A lightweight Flutter plugin that detects user inactivity (idle state) across all platforms: Android, iOS, Web, Windows, macOS, and Linux.

Perfect for banking apps, secure dashboards, or any app that needs to react when the user goes idle.


✨ Features

  • 🔄 Detect inactivity after custom timeout
  • 👨‍💻 Keyboard, mouse, touch & app lifecycle supported
  • 🖥️ Cross-platform (Android, iOS, Web, Desktop)
  • ⏱️ Remaining time tracking
  • 🛠️ Lightweight – no native code
  • 🔐 Ideal for auto logout, lock screen, and productivity

📦 Installation

dependencies:
  in_app_idle_detector: ^0.0.1

Working Demo

DEMO DEMO DEMO DEMO

🧑‍💻 Usage

  1. Initialize the plugin (e.g. inside main())
void main() {
  runApp(MyApp());

  InAppIdleDetector.initialize(
    timeout: Duration(seconds: 10), // Set your own duration
    onIdle: () {
      // Called when user goes idle
      print("User is idle");
    },
    onActive: () {
      // Called when user becomes active again
      print("User is active");
    },
  );
}
  1. Show a dialog or take action on idle
showDialog(
  context: navigatorKey.currentContext!,
  builder: (_) => AlertDialog(
    title: Text("Idle Warning"),
    content: Text("You've been inactive for 10 seconds."),
    actions: [
      TextButton(
        onPressed: () {
          Navigator.of(navigatorKey.currentContext!).pop();
        },
        child: Text("Dismiss"),
      ),
    ],
  ),
);
  1. Extra API (Pause / Resume / Reset)
InAppIdleDetector.pause();  // Stop tracking temporarily
InAppIdleDetector.resume(); // Resume tracking
InAppIdleDetector.reset();  // Manually reset idle timer
  1. Get Remaining Time
final timeLeft = InAppIdleDetector.remainingTime;
final idleStatus = InAppIdleDetector.isIdle;

✅ Use Cases

🔒 Auto-logout after inactivity (e.g., in banking apps)

🔐 Lock screen on desktops after idle

⏱️ Countdown timers for session expiration

📉 Inactivity analytics and user behavior tracking

🧪 Platform Support

Platform Supported
✅ Android Yes
✅ iOS Yes
✅ Web Yes
✅ Windows Yes
✅ macOS Yes
✅ Linux Yes

📚 API Summary

Method Description initialize(...) Starts the idle detection system reset() Resets the timer (e.g. after activity) pause() Temporarily disables tracking resume() Resumes tracking isIdle Returns true if currently idle remainingTime Returns Duration until next idle trigger

💡 Tips

Always use navigatorKey.currentContext for dialogs to ensure it works from anywhere. You can build a visual countdown using remainingTime and a Timer.periodic.

Support the Project

If you find this plugin helpful, consider supporting its development:

Your support is greatly appreciated!

Bugs/Requests

Feel free to open an issue if you encounter any problems or think that the plugin is missing some feature.

sheth02parth1299@gmail.com

🙌 Author

Created by Parth Sheth 🧠 Contributions, stars, and feedback are welcome!

カテゴリー

依存関係

依存関係一覧 2 件

  • plugin_platform_interface^2.0.2
  • web^1.0.0

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。