proximity_manager 1.0.4 copy "proximity_manager: ^1.0.4" to clipboard
proximity_manager: ^1.0.4 copied to clipboard

PlatformAndroid

A Flutter plugin to manage the proximity sensor, which allows to detect when an object is near to the device. This feature is use when the user is in a call and the device is near to the ear, the scre [...]

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:proximity_manager/proximity_manager.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            ElevatedButton(
              onPressed: () {
                ProximityManager.toggleProximityManager(true);
              },
              child: Text('Turn on proximity manager'),
            ),
            ElevatedButton(
              onPressed: () {
                ProximityManager.toggleProximityManager(false);
              },
              child: Text('Turn off proximity manager'),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
135
points
977
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to manage the proximity sensor, which allows to detect when an object is near to the device. This feature is use when the user is in a call and the device is near to the ear, the screen turns off to prevent unwanted touches.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on proximity_manager

Packages that implement proximity_manager