screen_brightness_pro 1.0.1
screen_brightness_pro: ^1.0.1 copied to clipboard
A professional Flutter plugin to control screen brightness, manage native wakelocks, and monitor battery status across 6 platforms (Android, iOS, macOS, Windows, Web, Linux).
Screen Brightness Pro #
A professional, high-performance Flutter plugin for controlling screen brightness, managing native wakelocks, and monitoring battery status across mobile, desktop, and web platforms.
Why Screen Brightness Pro? #
Most existing brightness plugins only support mobile platforms or require separate plugins for wakelock and battery features. Screen Brightness Pro is a unified, all-in-one solution designed for production-grade apps.
| Feature | Screen Brightness Pro | Others |
|---|---|---|
| Multi-Platform | Android, iOS, macOS, Windows, Web, Linux | ❌ Mobile Only |
| Native Wakelock | ✅ Integrated (6 Platforms) | ❌ Requires extra plugin |
| Battery Awareness | ✅ Built-in (6 Platforms) | ❌ Not available |
| Smooth Transitions | ✅ Native & Dart support | ❌ Instant only |
| System Brightness | ✅ 5 Platforms (Web uses Simulation) | ❌ Limited |
Features #
- 🌐 Universal Support: Android, iOS, macOS, Windows, Web, and Linux.
- 💡 Brightness Control: Change application-level or system-wide brightness.
- 🌫️ Simulated Web Brightness: Uses a smart overlay to dim the web app when system APIs are unavailable.
- ⚡ Native Wakelock: Keep the screen awake during critical tasks without extra dependencies.
- 🔋 Battery Monitor: Detect battery level and Low Power Mode to auto-optimize brightness.
- 🌊 Smooth Transitions: Gradually change brightness for a premium user experience.
- 🔄 Auto-Reset: Clean up brightness overrides when the app is paused or closed.
Platform Support & Requirements #
| Platform | Minimum Version | Specifics |
|---|---|---|
| Android | API 21+ | Requires WRITE_SETTINGS for system brightness. |
| iOS | 12.0+ | No permissions required. |
| macOS | 10.11+ | Low Power Mode requires macOS 12.0+. |
| Windows | Windows 10+ | Uses Win32 & WMI APIs. |
| Web | Modern Browsers | Uses Screen Wake Lock & Battery Status APIs. |
| Linux | GTK+ 3.0 | Uses D-Bus for system interaction. |
Installation #
Add screen_brightness_pro to your pubspec.yaml:
dependencies:
screen_brightness_pro: ^1.0.1
Android Setup #
To change system-wide brightness (optional), add this to your AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions"/>
Usage #
Simple Brightness Control #
import 'package:screen_brightness_pro/screen_brightness_pro.dart';
// Set brightness to 70%
ScreenBrightnessPro.setBrightness(0.7);
// Set with smooth transition (500ms)
ScreenBrightnessPro.setBrightness(0.7, smooth: true);
// Get current brightness
double current = await ScreenBrightnessPro.getBrightness();
Native Wakelock #
// Keep screen on
ScreenBrightnessPro.setKeepScreenOn(true);
// Allow screen to sleep again
ScreenBrightnessPro.setKeepScreenOn(false);
Battery Aware Optimization #
// Check battery status
double level = await ScreenBrightnessPro.getBatteryLevel();
bool isLowPower = await ScreenBrightnessPro.isLowPowerModeEnabled();
// Manually optimize (will reduce brightness if battery < 20%)
ScreenBrightnessPro.optimizeForLowBattery();
Reset to Default #
// Revert all app-level overrides
ScreenBrightnessPro.resetBrightness();
Contributing & Issues #
Found a bug or have a feature request? We'd love to hear from you!
- Check existing issues: Before opening a new one, please check if someone else has already reported it.
- Report a Bug: Provide clear reproduction steps, expected vs. actual behavior, and details about your platform (Android/iOS/Desktop).
- Suggest a Feature: Clearly explain the use case and how it would benefit other developers.
Report issues on the GitHub Issue Tracker.
Maintainer #
Maintained by Farhan Choksi. Feel free to support the project by giving it a ⭐ on GitHub!
License #
Licensed under the MIT License.