showDesktopDialog<T> function

Future<T?> showDesktopDialog<T>(
  1. BuildContext context,
  2. Widget page, {
  3. double width = 480,
  4. double height = 600,
})

桌面/Web 端以弹框方式打开页面 在桌面端所有需要导航到新页面的场景下,使用此函数替代 Navigator.push, 以保持左右分栏布局不被破坏。 width 弹框内容区域宽度,默认 480 height 弹框内容区域高度,默认 600

Implementation

Future<T?> showDesktopDialog<T>(
  BuildContext context,
  Widget page, {
  double width = 480,
  double height = 600,
}) {
  return showDialog<T>(
    context: context,
    builder: (_) => Dialog(
      insetPadding: const EdgeInsets.symmetric(horizontal: 40, vertical: 24),
      child: ClipRRect(
        borderRadius: BorderRadius.circular(12),
        child: SizedBox(width: width, height: height, child: page),
      ),
    ),
  );
}