Flutter plugin to get the current device screen corner radius on Android and iOS.
- Android: uses Android 12+
RoundedCornerviaWindowInsets, with fallback to the system dimenrounded_corner_radiuswhen available. - iOS: integrates a BezelKit hook for accurate device bezels
Inspired by and Android logic adapted from screen_corner_radius GitHub repo.
For iOS bezel data, see BezelKit GitHub repo and documentation at swiftpackageindex.com/markbattistella/BezelKit/documentation.
Add to your pubspec.yaml:
dependencies:
corner_radius_plugin: anyInitialize during app startup, e.g. in main() or initState().
import 'package:corner_radius_plugin/corner_radius_plugin.dart';
final screenRadius = await CornerRadiusPlugin.init();
if (screenRadius != null) {
print('TL: ${screenRadius.topLeft}');
}Get radius
final screenRadius = CornerRadiusPlugin.screenRadius;Setting default value
CornerRadiusPlugin.setDefaultRadius(5.0);The plugin bundles bezel.min.json from BezelKit and looks up the radius by device model identifier (e.g. iPhone14,2). The JSON is auto-updated weekly via GitHub Actions.
- Source JSON: bezel.min.json
- Auto updater workflow:
.github/workflows/update_bezel_json.yml
At runtime the plugin:
- Reads
assets/bezel.min.json(auto-refreshed weekly) - Gets the current model with
getModelIdentifierplatform method on iOS - Returns the device bezel value using "bezel" (or legacy "bazel") key; Android uses native API, iOS uses JSON lookup
On Android 12 (API 31)+ the radii are per-corner. On lower APIs, a single value from rounded_corner_radius is used when available; otherwise zeros are returned.