showYPlatformDialog<T> function
Future<T?>
showYPlatformDialog<T>({
- required BuildContext context,
- required Widget child,
- dynamic androidBarrierDismissible = false,
- dynamic canPop = false,
- Color? androidBarrierColor,
Implementation
Future<T?> showYPlatformDialog<T>({
required BuildContext context,
required Widget child,
androidBarrierDismissible = false,
useRootNavigator = true,
canPop = false,
Color? androidBarrierColor,
}) {
if (kIsWeb) {
return showDialog<T>(
context: context,
builder: (BuildContext context) {
return PopScope(
canPop: canPop,
child: child
);
},
barrierDismissible: androidBarrierDismissible,
useRootNavigator: useRootNavigator);
} else {
final platform = Theme
.of(context)
.platform;
switch (platform) {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.android:
return showDialog<T>(
context: context,
builder: (BuildContext context) {
return PopScope(
canPop: canPop,
child: child
);
},
barrierColor: androidBarrierColor,
barrierDismissible: androidBarrierDismissible,
useRootNavigator: useRootNavigator,
);
case TargetPlatform.macOS:
case TargetPlatform.iOS:
return showCupertinoDialog<T>(
context: context,
builder: (BuildContext context) {
return PopScope(
canPop: canPop,
child: child
);
},
useRootNavigator: useRootNavigator,
);
default:
throw UnsupportedError("Platform is not supported by this plugin.");
}
}
}