Skip to content

Commit

Permalink
Rename padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-P committed Apr 27, 2024
1 parent c643019 commit 0044b90
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions packages/fleather/lib/src/widgets/editor_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ class SelectorScopeState extends State<SelectorScope> {
}
}

const _kMenuScreenPadding = 8.0;
const _selectorScreenPadding = 8.0;

// This is a clone of _PopupMenuRouteLayout from Flutter with some modifications
class _SelectorLayout extends SingleChildLayoutDelegate {
Expand Down Expand Up @@ -1324,7 +1324,7 @@ class _SelectorLayout extends SingleChildLayoutDelegate {
// The menu can be at most the size of the overlay minus 8.0 pixels in each
// direction.
return BoxConstraints.loose(constraints.biggest).deflate(
const EdgeInsets.all(_kMenuScreenPadding) + padding,
const EdgeInsets.all(_selectorScreenPadding) + padding,
);
}

Expand Down Expand Up @@ -1370,19 +1370,22 @@ class _SelectorLayout extends SingleChildLayoutDelegate {
double y = wantedPosition.dy;
// Avoid going outside an area defined as the rectangle 8.0 pixels from the
// edge of the screen in every direction.
if (x < screen.left + _kMenuScreenPadding + padding.left) {
x = screen.left + _kMenuScreenPadding + padding.left;
if (x < screen.left + _selectorScreenPadding + padding.left) {
x = screen.left + _selectorScreenPadding + padding.left;

Check warning on line 1374 in packages/fleather/lib/src/widgets/editor_toolbar.dart

View check run for this annotation

Codecov / codecov/patch

packages/fleather/lib/src/widgets/editor_toolbar.dart#L1374

Added line #L1374 was not covered by tests
} else if (x + childSize.width >
screen.right - _kMenuScreenPadding - padding.right) {
x = screen.right - childSize.width - _kMenuScreenPadding - padding.right;
screen.right - _selectorScreenPadding - padding.right) {
x = screen.right -
childSize.width -
_selectorScreenPadding -
padding.right;

Check warning on line 1380 in packages/fleather/lib/src/widgets/editor_toolbar.dart

View check run for this annotation

Codecov / codecov/patch

packages/fleather/lib/src/widgets/editor_toolbar.dart#L1377-L1380

Added lines #L1377 - L1380 were not covered by tests
}
if (y < screen.top + _kMenuScreenPadding + padding.top) {
y = _kMenuScreenPadding + padding.top;
if (y < screen.top + _selectorScreenPadding + padding.top) {
y = _selectorScreenPadding + padding.top;

Check warning on line 1383 in packages/fleather/lib/src/widgets/editor_toolbar.dart

View check run for this annotation

Codecov / codecov/patch

packages/fleather/lib/src/widgets/editor_toolbar.dart#L1383

Added line #L1383 was not covered by tests
} else if (y + childSize.height >
screen.bottom - _kMenuScreenPadding - padding.bottom) {
screen.bottom - _selectorScreenPadding - padding.bottom) {
y = screen.bottom -
childSize.height -
_kMenuScreenPadding -
_selectorScreenPadding -
padding.bottom;
}

Expand Down

0 comments on commit 0044b90

Please sign in to comment.