@@ -60,17 +60,18 @@ class PopupState extends State<Popup> {
60
60
@override
61
61
Widget build (BuildContext context) {
62
62
final verticalFlipRequired = _isVerticalFlipRequired ();
63
- final bool horizontalOverflow =
64
- widget.normalOffset.dx + Sizes .autocompletePopupMaxWidth >
65
- widget.editingWindowSize.width;
63
+ final bool isHorizontalOverflowed = _isHorizontallyOverflowed ();
66
64
final double leftOffsetLimit =
67
65
// TODO(nausharipov): find where 100 comes from
68
- widget.editingWindowSize.width - Sizes .autocompletePopupMaxWidth - 100 ;
66
+ widget.editingWindowSize.width -
67
+ Sizes .autocompletePopupMaxWidth +
68
+ (widget.editorOffset? .dx ?? 0 ) -
69
+ 100 ;
69
70
70
71
return PageStorage (
71
72
bucket: pageStorageBucket,
72
73
child: Positioned (
73
- left: horizontalOverflow ? leftOffsetLimit : widget.normalOffset.dx,
74
+ left: isHorizontalOverflowed ? leftOffsetLimit : widget.normalOffset.dx,
74
75
top: verticalFlipRequired
75
76
? widget.flippedOffset.dy
76
77
: widget.normalOffset.dy,
@@ -120,6 +121,13 @@ class PopupState extends State<Popup> {
120
121
return isPopupOverflowingHeight && isPopupShorterThanWindow;
121
122
}
122
123
124
+ bool _isHorizontallyOverflowed () {
125
+ return widget.normalOffset.dx -
126
+ (widget.editorOffset? .dx ?? 0 ) +
127
+ Sizes .autocompletePopupMaxWidth >
128
+ widget.editingWindowSize.width;
129
+ }
130
+
123
131
Widget _buildListItem (int index) {
124
132
return Material (
125
133
color: Colors .grey.withOpacity (0.1 ),
0 commit comments