usePlatform method
void
usePlatform({})
Implementation
void usePlatform({
Widget Function(Niku)? base,
Widget Function(Niku)? android,
Widget Function(Niku)? iOS,
Widget Function(Niku)? fuchsia,
Widget Function(Niku)? linux,
Widget Function(Niku)? macOS,
Widget Function(Niku)? windows,
Widget Function(Niku)? web,
}) {
useChild(
(child) => Builder(
builder: (context) {
fallback(Widget Function(Niku)? builder) {
if (builder != null) return builder(child);
return child;
}
if (kIsWeb)
return fallback(web);
else
switch (Theme.of(context).platform) {
case TargetPlatform.android:
return fallback(android);
case TargetPlatform.iOS:
return fallback(iOS);
case TargetPlatform.fuchsia:
return fallback(fuchsia);
case TargetPlatform.linux:
return fallback(linux);
case TargetPlatform.macOS:
return fallback(macOS);
case TargetPlatform.windows:
return fallback(windows);
}
},
),
);
}