diff --git a/.cloud_build/dart_pad.yaml b/.cloud_build/dart_pad.yaml index 0ef138ac0..64b81d9f8 100644 --- a/.cloud_build/dart_pad.yaml +++ b/.cloud_build/dart_pad.yaml @@ -1,6 +1,6 @@ steps: - name: gcr.io/$PROJECT_ID/flutter:main - args: ['build', 'web'] + args: ['build', 'web', '--wasm'] dir: pkgs/dartpad_ui - name: gcr.io/$PROJECT_ID/firebase args: ['deploy', '--project=$PROJECT_ID', '--only', 'hosting:dartpad'] diff --git a/pkgs/dartpad_ui/lib/editor/editor.dart b/pkgs/dartpad_ui/lib/editor/editor.dart index d06a19ef2..50b918919 100644 --- a/pkgs/dartpad_ui/lib/editor/editor.dart +++ b/pkgs/dartpad_ui/lib/editor/editor.dart @@ -199,7 +199,10 @@ class _EditorWidgetState extends State implements EditorService { // darkmode _updateCodemirrorMode(darkMode); - Timer.run(() => codeMirror!.refresh()); + // Use a longer delay so that the platform view is displayed + // correctly when compiled to Wasm + Future.delayed( + const Duration(milliseconds: 80), () => codeMirror!.refresh()); codeMirror!.on( 'change', @@ -258,7 +261,10 @@ class _EditorWidgetState extends State implements EditorService { for (final entry in entries.toDart) { if (entry.isIntersecting) { observer.unobserve(web.document.body!); - Timer.run(() => codeMirror!.refresh()); + // Use a longer delay so that the platform view is displayed + // correctly when compiled to Wasm + Future.delayed( + const Duration(milliseconds: 80), () => codeMirror!.refresh()); return; } }