@@ -263,107 +263,19 @@ class PlatformDispatcher {
263263 // Called from the engine, via hooks.dart
264264 //
265265 // Updates the metrics of the window with the given id.
266- void _updateWindowMetrics (
267- int id,
268- double devicePixelRatio,
269- double width,
270- double height,
271- double viewPaddingTop,
272- double viewPaddingRight,
273- double viewPaddingBottom,
274- double viewPaddingLeft,
275- double viewInsetTop,
276- double viewInsetRight,
277- double viewInsetBottom,
278- double viewInsetLeft,
279- double systemGestureInsetTop,
280- double systemGestureInsetRight,
281- double systemGestureInsetBottom,
282- double systemGestureInsetLeft,
283- double physicalTouchSlop,
284- List <double > displayFeaturesBounds,
285- List <int > displayFeaturesType,
286- List <int > displayFeaturesState,
287- int displayId,
288- ) {
289- final _ViewConfiguration viewConfiguration = _ViewConfiguration (
290- devicePixelRatio: devicePixelRatio,
291- geometry: Rect .fromLTWH (0.0 , 0.0 , width, height),
292- viewPadding: ViewPadding ._(
293- top: viewPaddingTop,
294- right: viewPaddingRight,
295- bottom: viewPaddingBottom,
296- left: viewPaddingLeft,
297- ),
298- viewInsets: ViewPadding ._(
299- top: viewInsetTop,
300- right: viewInsetRight,
301- bottom: viewInsetBottom,
302- left: viewInsetLeft,
303- ),
304- padding: ViewPadding ._(
305- top: math.max (0.0 , viewPaddingTop - viewInsetTop),
306- right: math.max (0.0 , viewPaddingRight - viewInsetRight),
307- bottom: math.max (0.0 , viewPaddingBottom - viewInsetBottom),
308- left: math.max (0.0 , viewPaddingLeft - viewInsetLeft),
309- ),
310- systemGestureInsets: ViewPadding ._(
311- top: math.max (0.0 , systemGestureInsetTop),
312- right: math.max (0.0 , systemGestureInsetRight),
313- bottom: math.max (0.0 , systemGestureInsetBottom),
314- left: math.max (0.0 , systemGestureInsetLeft),
315- ),
316- gestureSettings: GestureSettings (
317- physicalTouchSlop: physicalTouchSlop == _kUnsetGestureSetting ? null : physicalTouchSlop,
318- ),
319- displayFeatures: _decodeDisplayFeatures (
320- bounds: displayFeaturesBounds,
321- type: displayFeaturesType,
322- state: displayFeaturesState,
323- devicePixelRatio: devicePixelRatio,
324- ),
325- displayId: displayId,
326- );
327-
328- final FlutterView ? view = _views[id];
329- if (id == _kImplicitViewId && view == null ) {
266+ void _updateWindowMetrics (int viewId, _ViewConfiguration viewConfiguration) {
267+ final FlutterView ? view = _views[viewId];
268+ if (viewId == _kImplicitViewId && view == null ) {
330269 // TODO(goderbauer): Remove the implicit creation of the implicit view
331270 // when we have an addView API and the implicit view is added via that.
332- _views[id ] = FlutterView ._(id , this , viewConfiguration);
271+ _views[viewId ] = FlutterView ._(viewId , this , viewConfiguration);
333272 } else {
334273 assert (view != null );
335274 view! ._viewConfiguration = viewConfiguration;
336275 }
337-
338276 _invoke (onMetricsChanged, _onMetricsChangedZone);
339277 }
340278
341- List <DisplayFeature > _decodeDisplayFeatures ({
342- required List <double > bounds,
343- required List <int > type,
344- required List <int > state,
345- required double devicePixelRatio,
346- }) {
347- assert (bounds.length / 4 == type.length, 'Bounds are rectangles, requiring 4 measurements each' );
348- assert (type.length == state.length);
349- final List <DisplayFeature > result = < DisplayFeature > [];
350- for (int i = 0 ; i < type.length; i++ ) {
351- final int rectOffset = i * 4 ;
352- result.add (DisplayFeature (
353- bounds: Rect .fromLTRB (
354- bounds[rectOffset] / devicePixelRatio,
355- bounds[rectOffset + 1 ] / devicePixelRatio,
356- bounds[rectOffset + 2 ] / devicePixelRatio,
357- bounds[rectOffset + 3 ] / devicePixelRatio,
358- ),
359- type: DisplayFeatureType .values[type[i]],
360- state: state[i] < DisplayFeatureState .values.length
361- ? DisplayFeatureState .values[state[i]]
362- : DisplayFeatureState .unknown,
363- ));
364- }
365- return result;
366- }
367279
368280 /// A callback invoked when any view begins a frame.
369281 ///
0 commit comments