flutter_system_action
is a Flutter plugin that provides a set of system actions such as adjusting
volume, toggling the torch, changing brightness, and more on Android devices.
- ๐ Adjust music volume (raise/lower)
- ๐ฆ Toggle the torch (flashlight) on/off
- ๐ Adjust screen brightness (raise/lower/max/zero)
- ๐ Adjust ringtone volume (raise/lower)
- ๐ Adjust notification volume (raise/lower)
- ๐ณ Toggle vibration mode on/off
- ๐ณ Toggle ring mode on
- ๐ Open display settings for dark mode
Add the following line to your pubspec.yaml
file:
dependencies:
flutter_system_action: ^1.0.2
Then, run flutter pub get to install the package.
This plugin requires certain permissions to function properly. Make sure to add the following permissions to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
Import the package in your Dart code:
import 'package:flutter_system_action/flutter_system_action.dart';
volumeButtonRaiseEvent()
: Increases the music volume.volumeButtonLowerEvent()
: Decreases the music volume.torchButtonOnEvent()
: Turns on the torch (flashlight)torchButtonOffEvent()
: Turns off the torch (flashlight).brightnessRaiseEvent()
: Increases the screen brightness.brightnessLowerEvent()
: Decreases the screen brightness.brightnessMaxEvent()
: Sets the screen brightness to maximum.brightnessZeroEvent()
: Sets the screen brightness to zero.ringtoneVolumeRaiseEvent()
: Increases the ringtone volume.ringtoneVolumeDownEvent()
: Decreases the ringtone volume.notificationVolumeRaisePress()
: Increases the notification volume.notificationVolumeDownPress()
: Decreases the notification volume.vibrationButtonPress()
: Sets the phone to vibration mode.ringModeOnButtonPress()
: Sets the phone to ring mode.darkModeEventButtonPressed()
: Opens the display settings for dark mode.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.