This plugin uses native APIs to get the corner radius of the device.
For Android, it uses the WindowInsets
API released along Android S.
Note: The
WindowInsets
API is only available on Android S (API 31) and above. Read more about the API here
For iOS, it read private _displayCornerRadius
property of UIScreen
class.
The Swift code used in this package was taken directly from @kylebshr's ScreenCorners
Import the package:
import 'package:device_corner_radius/device_corner_radius.dart';
And then use the getDeviceCornerRadius()
method:
BorderRadius cornerRadius = await DeviceCornerRadius.getCornerRadius();
Reported Values for Apple Devices (by @kylebshr)
Device | Value (pts) |
---|---|
iPhone 14 Pro / 14 Pro Max | 55.0 |
iPhone 13 Pro Max / 14 Plus / 12 Pro Max | 53.33 |
iPhone 14 / 13 Pro / 12 Pro / 12 | 47.33 |
iPhone 13 Mini / 12 Mini | 44.0 |
iPhone 11 Pro / 11 Pro Max / X / XS / XS Max | 39.0 |
iPhone XR / 11 | 41.5 |
iPad Air / iPad Pro 11-inch / 12.9-inch | 18.0 |
- Test on real Android devices
If you find any bugs or misplaced icons, please open an issue here.
This package is licensed under the MIT License