Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b0966e8

Browse files
authored
Revert "Remove the Window class now that it is no longer used. (#22505)" (#22519)
This reverts commit 2004a7b.
1 parent 7136009 commit b0966e8

File tree

3 files changed

+224
-9
lines changed

3 files changed

+224
-9
lines changed

lib/ui/window.dart

Lines changed: 215 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,220 @@ class AccessibilityFeatures {
795795
int get hashCode => _index.hashCode;
796796
}
797797

798+
/// A soon-to-be deprecated class that is wholly replaced by
799+
/// [SingletonFlutterWindow].
800+
///
801+
/// This class will be removed once the framework no longer refers to it.
802+
// In order for the documentation build to succeed, this interface duplicates
803+
// all of the methods with documentation, overrides them, and calls the super
804+
// implementation. Once this merges into the framework and the framework
805+
// references to it can be updated, this class will be removed entirely.
806+
class Window extends SingletonFlutterWindow {
807+
Window._(Object windowId, PlatformDispatcher platformDispatcher)
808+
: super._(windowId, platformDispatcher);
809+
810+
@override
811+
// ignore: unnecessary_overrides
812+
double get devicePixelRatio => super.devicePixelRatio;
813+
814+
@override
815+
// ignore: unnecessary_overrides
816+
Rect get physicalGeometry => super.physicalGeometry;
817+
818+
@override
819+
// ignore: unnecessary_overrides
820+
Size get physicalSize => super.physicalSize;
821+
822+
@override
823+
// ignore: unnecessary_overrides
824+
WindowPadding get viewInsets => super.viewInsets;
825+
826+
@override
827+
// ignore: unnecessary_overrides
828+
WindowPadding get viewPadding => super.viewPadding;
829+
830+
@override
831+
// ignore: unnecessary_overrides
832+
WindowPadding get systemGestureInsets => super.systemGestureInsets;
833+
834+
@override
835+
// ignore: unnecessary_overrides
836+
WindowPadding get padding => super.padding;
837+
838+
@override
839+
// ignore: unnecessary_overrides
840+
void render(Scene scene) => super.render(scene);
841+
842+
@override
843+
// ignore: unnecessary_overrides
844+
VoidCallback? get onMetricsChanged => super.onMetricsChanged;
845+
@override
846+
// ignore: unnecessary_overrides
847+
set onMetricsChanged(VoidCallback? callback) {
848+
super.onMetricsChanged = callback;
849+
}
850+
851+
@override
852+
// ignore: unnecessary_overrides
853+
Locale get locale => super.locale;
854+
855+
@override
856+
// ignore: unnecessary_overrides
857+
List<Locale> get locales => super.locales;
858+
859+
@override
860+
// ignore: unnecessary_overrides
861+
Locale? computePlatformResolvedLocale(List<Locale> supportedLocales) {
862+
return super.computePlatformResolvedLocale(supportedLocales);
863+
}
864+
865+
@override
866+
// ignore: unnecessary_overrides
867+
VoidCallback? get onLocaleChanged => super.onLocaleChanged;
868+
@override
869+
// ignore: unnecessary_overrides
870+
set onLocaleChanged(VoidCallback? callback) {
871+
super.onLocaleChanged = callback;
872+
}
873+
874+
@override
875+
// ignore: unnecessary_overrides
876+
String get initialLifecycleState => super.initialLifecycleState;
877+
878+
@override
879+
// ignore: unnecessary_overrides
880+
double get textScaleFactor => super.textScaleFactor;
881+
882+
@override
883+
// ignore: unnecessary_overrides
884+
bool get alwaysUse24HourFormat => super.alwaysUse24HourFormat;
885+
886+
@override
887+
// ignore: unnecessary_overrides
888+
VoidCallback? get onTextScaleFactorChanged => super.onTextScaleFactorChanged;
889+
@override
890+
// ignore: unnecessary_overrides
891+
set onTextScaleFactorChanged(VoidCallback? callback) {
892+
super.onTextScaleFactorChanged = callback;
893+
}
894+
895+
@override
896+
// ignore: unnecessary_overrides
897+
Brightness get platformBrightness => super.platformBrightness;
898+
899+
@override
900+
// ignore: unnecessary_overrides
901+
VoidCallback? get onPlatformBrightnessChanged => super.onPlatformBrightnessChanged;
902+
@override
903+
// ignore: unnecessary_overrides
904+
set onPlatformBrightnessChanged(VoidCallback? callback) {
905+
super.onPlatformBrightnessChanged = callback;
906+
}
907+
908+
@override
909+
// ignore: unnecessary_overrides
910+
FrameCallback? get onBeginFrame => super.onBeginFrame;
911+
@override
912+
// ignore: unnecessary_overrides
913+
set onBeginFrame(FrameCallback? callback) {
914+
super.onBeginFrame = callback;
915+
}
916+
917+
@override
918+
// ignore: unnecessary_overrides
919+
VoidCallback? get onDrawFrame => super.onDrawFrame;
920+
@override
921+
// ignore: unnecessary_overrides
922+
set onDrawFrame(VoidCallback? callback) {
923+
super.onDrawFrame = callback;
924+
}
925+
926+
@override
927+
// ignore: unnecessary_overrides
928+
TimingsCallback? get onReportTimings => super.onReportTimings;
929+
@override
930+
// ignore: unnecessary_overrides
931+
set onReportTimings(TimingsCallback? callback) {
932+
super.onReportTimings = callback;
933+
}
934+
935+
@override
936+
// ignore: unnecessary_overrides
937+
PointerDataPacketCallback? get onPointerDataPacket => super.onPointerDataPacket;
938+
@override
939+
// ignore: unnecessary_overrides
940+
set onPointerDataPacket(PointerDataPacketCallback? callback) {
941+
super.onPointerDataPacket = callback;
942+
}
943+
944+
@override
945+
// ignore: unnecessary_overrides
946+
String get defaultRouteName => super.defaultRouteName;
947+
948+
@override
949+
// ignore: unnecessary_overrides
950+
void scheduleFrame() => super.scheduleFrame();
951+
952+
@override
953+
// ignore: unnecessary_overrides
954+
bool get semanticsEnabled => super.semanticsEnabled;
955+
956+
@override
957+
// ignore: unnecessary_overrides
958+
VoidCallback? get onSemanticsEnabledChanged => super.onSemanticsEnabledChanged;
959+
@override
960+
// ignore: unnecessary_overrides
961+
set onSemanticsEnabledChanged(VoidCallback? callback) {
962+
super.onSemanticsEnabledChanged = callback;
963+
}
964+
965+
@override
966+
// ignore: unnecessary_overrides
967+
SemanticsActionCallback? get onSemanticsAction => super.onSemanticsAction;
968+
@override
969+
// ignore: unnecessary_overrides
970+
set onSemanticsAction(SemanticsActionCallback? callback) {
971+
super.onSemanticsAction = callback;
972+
}
973+
974+
@override
975+
// ignore: unnecessary_overrides
976+
AccessibilityFeatures get accessibilityFeatures => super.accessibilityFeatures;
977+
978+
@override
979+
// ignore: unnecessary_overrides
980+
VoidCallback? get onAccessibilityFeaturesChanged =>
981+
super.onAccessibilityFeaturesChanged;
982+
@override
983+
// ignore: unnecessary_overrides
984+
set onAccessibilityFeaturesChanged(VoidCallback? callback) {
985+
super.onAccessibilityFeaturesChanged = callback;
986+
}
987+
988+
@override
989+
// ignore: unnecessary_overrides
990+
void updateSemantics(SemanticsUpdate update) => super.updateSemantics(update);
991+
992+
@override
993+
// ignore: unnecessary_overrides
994+
void sendPlatformMessage(String name, ByteData? data, PlatformMessageResponseCallback? callback) {
995+
super.sendPlatformMessage(name, data, callback);
996+
}
997+
998+
@override
999+
// ignore: unnecessary_overrides
1000+
PlatformMessageCallback? get onPlatformMessage => super.onPlatformMessage;
1001+
@override
1002+
// ignore: unnecessary_overrides
1003+
set onPlatformMessage(PlatformMessageCallback? callback) {
1004+
super.onPlatformMessage = callback;
1005+
}
1006+
1007+
@override
1008+
// ignore: unnecessary_overrides
1009+
void setIsolateDebugName(String name) => super.setIsolateDebugName(name);
1010+
}
1011+
7981012
/// Describes the contrast of a theme or color palette.
7991013
enum Brightness {
8001014
/// The color is dark and will require a light text color to achieve readable
@@ -839,4 +1053,4 @@ enum Brightness {
8391053
/// * [PlatformDispatcher.views], contains the current list of Flutter windows
8401054
/// belonging to the application, including top level application windows like
8411055
/// this one.
842-
final SingletonFlutterWindow window = SingletonFlutterWindow._(0, PlatformDispatcher.instance);
1056+
final Window window = Window._(0, PlatformDispatcher.instance);

lib/web_ui/lib/src/engine/html/scene_builder.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,13 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
307307
/// - 0x08: visualizeEngineStatistics - graph UI thread frame times
308308
/// Set enabledOptions to 0x0F to enable all the currently defined features.
309309
///
310-
/// The "UI thread" is the thread that includes all the execution of the main
311-
/// Dart isolate (the isolate that can call [FlutterView.render]). The UI
312-
/// thread frame time is the total time spent executing the
313-
/// [FlutterView.onBeginFrame] callback. The "raster thread" is the thread
314-
/// (running on the CPU) that subsequently processes the [Scene] provided by
315-
/// the Dart code to turn it into GPU commands and send it to the GPU.
310+
/// The "UI thread" is the thread that includes all the execution of
311+
/// the main Dart isolate (the isolate that can call
312+
/// [Window.render]). The UI thread frame time is the total time
313+
/// spent executing the [Window.onBeginFrame] callback. The "raster
314+
/// thread" is the thread (running on the CPU) that subsequently
315+
/// processes the [Scene] provided by the Dart code to turn it into
316+
/// GPU commands and send it to the GPU.
316317
///
317318
/// See also the [PerformanceOverlayOption] enum in the rendering library.
318319
/// for more details.
@@ -521,7 +522,7 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
521522
///
522523
/// Returns a [Scene] containing the objects that have been added to
523524
/// this scene builder. The [Scene] can then be displayed on the
524-
/// screen with [FlutterView.render].
525+
/// screen with [Window.render].
525526
///
526527
/// After calling this function, the scene builder object is invalid and
527528
/// cannot be used further.

lib/web_ui/lib/src/engine/platform_dispatcher.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
174174
/// rasterized frames.
175175
///
176176
/// It's preferred to use [SchedulerBinding.addTimingsCallback] than to use
177-
/// [PlatformDispatcher.onReportTimings] directly because
177+
/// [Window.onReportTimings] directly because
178178
/// [SchedulerBinding.addTimingsCallback] allows multiple callbacks.
179179
///
180180
/// This can be used to see if the application has missed frames (through

0 commit comments

Comments
 (0)