Files
SpotiFLAC-Mobile/lib/widgets/native_glass_metrics.dart
zarzet 55a390d679 fix(ui): correct glass shader coordinates on scaled tablets
Use native window metrics for glass shaders while preserving scaled layout metrics for their content. Cover fullscreen tablet orientations and resizing to a compact window.

Fixes #597
2026-09-25 21:11:30 +07:00

26 lines
855 B
Dart

import 'package:flutter/widgets.dart';
/// Gives glass shaders the actual window's coordinate system.
///
/// AdaptiveUiScaler changes MediaQuery's size and density for layout and image
/// decoding. The glass renderer already includes that ancestor transform when
/// positioning its shader, so using the scaled density again displaces the
/// effect from its clip (especially near the bottom of a tablet screen).
class NativeGlassMetrics extends StatelessWidget {
const NativeGlassMetrics({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
final view = View.of(context);
return MediaQuery(
data: MediaQuery.of(context).copyWith(
size: view.physicalSize / view.devicePixelRatio,
devicePixelRatio: view.devicePixelRatio,
),
child: child,
);
}
}