Flutter Screen Time lets you block distracting apps on iOS and Android.
| iOS | Android |
|---|---|
![]() |
![]() |
- Get permission status
- Select apps to block
- Block/unblock apps
- Customise the Android blocking overlay UI (title, message, colours, text sizes, buttons)
Add the plugin to your pubspec.yaml file:
dependencies:
flutter_screen_time_api: ^1.0.0iOS and Android use very different mechanisms:
- iOS uses the first-party Family Controls / Screen Time API. You configure the shield with
setShieldConfiguration. - Android has no system-level Screen Time API, so blocking is built from two special-access permissions the user must grant — "Display over other apps" (to draw the shield) and "Usage access" (to detect the foreground app). A foreground service then polls the current app and draws a full-screen overlay over blocked apps. You customise that overlay with
configureAndroidOverlayUI.
The public Dart API is shared across both platforms:
final _flutterScreenTimePlugin = FlutterScreenTime();Make sure your Xcode target has the Family Controls capability enabled.
No manifest changes are required — the plugin declares the permissions it needs
(SYSTEM_ALERT_WINDOW, PACKAGE_USAGE_STATS, FOREGROUND_SERVICE, …). The two
special-access permissions are granted by the user at runtime; calling
getAuthorization() opens the relevant system settings screens for them.
final _flutterScreenTimePlugin = FlutterScreenTime();Future<int> checkAuthorization() async {
return await _flutterScreenTimePlugin.checkAuthorization();
}Statuses:
-1 -> Permission denied
1 -> Permission granted
0 -> Not determined
On Android this returns
1only when both the overlay and usage-access permissions are granted, otherwise0.
void getAuthorization() {
_flutterScreenTimePlugin.getAuthorization();
}On Android this opens the "Display over other apps" screen first and then the "Usage access" screen (they can't be requested together).
void chooseApps() {
_flutterScreenTimePlugin.chooseApps();
}On Android this launches a native app picker (the analog of the iOS
FamilyActivityPicker).
void blockApps() {
_flutterScreenTimePlugin.blockApps();
}void unblockApps() {
_flutterScreenTimePlugin.unblockApps();
}Use configureAndroidOverlayUI to style the full-screen overlay shown on top of
a blocked app. It is Android-only (a no-op on iOS) and every field is
optional — anything you leave out keeps its built-in default. Colors accept
#RGB, #RRGGBB or #RRGGBBAA (alpha last).
await _flutterScreenTimePlugin.configureAndroidOverlayUI(
const AndroidOverlayConfiguration(
title: 'Stay focused',
message: 'This app is blocked during focus hours.',
backgroundColorHex: '#111827',
titleColorHex: '#FFFFFF',
messageColorHex: '#D1D5DB',
primaryButtonLabel: 'Got it',
primaryButtonBackgroundColorHex: '#2563EB',
primaryButtonTextColorHex: '#FFFFFF',
secondaryButtonLabel: 'Close',
secondaryButtonBackgroundColorHex: null, // outlined button
secondaryButtonTextColorHex: '#FFFFFF',
titleFontSize: 24,
messageFontSize: 16,
cornerRadius: 12,
),
);| Field | Type | Default | Description |
|---|---|---|---|
title |
String (required) |
App blocked |
Bold heading at the top of the overlay. |
message |
String? |
This app is blocked right now. |
Supporting line under the title. Hidden when null/empty. |
backgroundColorHex |
String? |
#111827 |
Overlay background fill. |
titleColorHex |
String? |
#FFFFFF |
Title text colour. |
messageColorHex |
String? |
#D1D5DB |
Message text colour. |
primaryButtonLabel |
String? |
OK |
Primary (dismiss) button label. |
primaryButtonBackgroundColorHex |
String? |
#2563EB |
Primary button fill. |
primaryButtonTextColorHex |
String? |
#FFFFFF |
Primary button text colour. |
secondaryButtonLabel |
String? |
none | Optional secondary button label. Hidden when null/empty. |
secondaryButtonBackgroundColorHex |
String? |
outlined | Secondary button fill. When null the button is outlined. |
secondaryButtonTextColorHex |
String? |
#FFFFFF |
Secondary button text colour. |
titleFontSize |
double? |
24 |
Title text size (sp). |
messageFontSize |
double? |
16 |
Message text size (sp). |
cornerRadius |
double? |
12 |
Button corner radius (dp). |


