user_inactivity_detector

Creator: coderz1093

Last updated:

0 purchases

user_inactivity_detector Image
user_inactivity_detector Images

Languages

Categories

Add to Cart

Description:

user inactivity detector

User inactivity detector #
User inactivity detector reacts to user inactivity
For example you have a banking application and you need to lock the device after the expiration date for example 30 seconds this plugin solves your problem
Overview of parameters #
Duration duration the delay after which the onStopped function will be executed.
Function onStopped will be executed when the user is inactive.
bool enabled this is a flag if its value is true, everything works if it is false, then the function stops working
for example, you can disable after execution
Usage #
initialize
You need to provide it to the root widget
like bellow
import 'package:flutter/material.dart';
import 'package:user_inactivity_detector/service/timer_service.dart';
import 'package:user_inactivity_detector/service/timer_service_provider.dart';

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return TimerServiceProvider(
service: TimerService(),
child: MaterialApp(
title: 'Flutter Smart Detector',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: YourHome(),
),
);
}
}

copied to clipboard
Example Usage
The onStopped function will trigger when the user is idle with a delay of 2 seconds
import 'package:flutter/material.dart';
import 'package:user_inactivity_detector/user_inactivity_detector.dart';

class Example extends StatelessWidget {
const Example({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
body: UserInactivityDetector(
duration: const Duration(seconds: 2),
onStopped: () {
print('stopped');
},
child: SingleChildScrollView(
child: Column(
children: List.generate(
30,
(index) => ListTile(
title: Text(index.toString()),
),
),
),
),
),
);
}
}
copied to clipboard
©Copyright 2022

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.