FLUTTER ECOSYSTEM

ParthSheth021299/in_app_idle_detector

모든 플랫폼(안드로이드, iOS, 웹, 윈도우, 맥OS, 리눅스)에서 사용자 비활성 상태(아이들 상태)를 감지하는 가벼운 플러터 플러그인입니다. 은행 앱, 보안 대시보드 또는 사용자가 아이들 상태가 되었을 때 반응해야 하는 모든 앱에 적합합니다.

in_app_idle_detector 프로젝트 이미지
Stars
1
Forks
4
최근 푸시(UTC)
2025. 6. 26.
프로젝트 상태
활성
Parth Sheth GitHub avatar
GITHUB User

Parth Sheth ↗

🚀 Flutter Developer | Building Beautiful Cross-Platform Apps 📱 2 Years of Flutter Experience | 💡 Passionate About Crafting Engaging User Experiences🌐

언어C++CMakeDartSwiftCRubyKotlinHTMLObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 6 개
  • flutter{"sdk":"flutter"}
  • flutter_web_plugins{"sdk":"flutter"}
  • web^1.0.0
  • plugin_platform_interface^2.0.2
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^5.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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!