resolvePlatformStyle function
Resolves the DmPlatformStyle for the current context.
Resolution order:
widgetOverride(per-widget parameter)- Nearest DmPlatformOverride ancestor (subtree override)
- Nearest DuskmoonApp ancestor (app-level override)
- Platform default from Theme.of(context).platform
Implementation
DmPlatformStyle resolvePlatformStyle(
BuildContext context, {
DmPlatformStyle? widgetOverride,
}) {
if (widgetOverride != null) return widgetOverride;
final subtreeOverride = DmPlatformOverride.maybeOf(context);
if (subtreeOverride != null) return subtreeOverride;
final appStyle = DuskmoonApp.maybeStyleOf(context);
if (appStyle != null) return appStyle;
return _defaultStyle(Theme.of(context).platform);
}