open static method
弹出对话框
Implementation
static Future<void> open({
bool barrierDismissible = false,
bool useSafeArea = true,
bool useRootNavigator = true,
bool scrollable = false,
bool showCloseButton = false,
Image? image,
Widget? title,
required Widget content,
required TdDialogActions actionButton,
}) {
final completer = Completer<void>();
final context = TdConfig.instance.context;
final theme = TdTheme.of(context);
Navigator.of(context, rootNavigator: useRootNavigator).push(TdDialogRoute(
builder: (context) {
final mediaQuery = MediaQuery.sizeOf(context);
final maxWidth = mediaQuery.width - theme.spacer2 * 2;
final maxHeight = mediaQuery.height - theme.spacer6 * 2;
return Center(
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: min(320.0, maxWidth),
maxHeight: maxHeight,
),
child: TdDialog(
onClosed: () {
TdPopupPlugin.pop();
completer.complete();
},
scrollable: scrollable,
showCloseButton: showCloseButton,
image: image,
title: title,
content: content,
actionButton: actionButton,
),
),
);
},
barrierColor: theme.maskActive,
barrierDismissible: barrierDismissible,
useSafeArea: useSafeArea,
traversalEdgeBehavior: TraversalEdgeBehavior.closedLoop,
));
return completer.future;
}