mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix: Submenu anchor misaligned with child panel in web (Resolved #151081) - The issue comes from different in calculating the position of the menu in web and mobile. - The calculation is currently base on function `getPositionForChild()` inside `_MenuLayout` in `menu_anchor.dart`, which base on the `anchorRect` - The calculation of `anchorRect` is from `upperLeft` and `bottomRight` - `upperLeft` is result of `localToGlobal()` function, which take the `point` arguments to be the base line. Right now, `point` is refer to `Offset.zero`, but it should not be Offset.zero since we having `densityAdjustment`, which is different between web and mobile - Change `point` from `Offset.zero` to `Offset(dx, -dy)` should fix the error. Use `dx` instead of `-dx` since `dx` already be recalculated refer to the above comment on `densityAdjustment`. Before:  After:  Issue: https://github.com/flutter/flutter/issues/151081