Skip to content

Commit

Permalink
🔧 Update dependencies of examples & fix terminal resizing check to ac…
Browse files Browse the repository at this point in the history
…count for handle instead of cursor delta.
  • Loading branch information
SaadArdati committed May 16, 2024
1 parent fbb1d28 commit c303e57
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
8 changes: 8 additions & 0 deletions packages/box_transform/lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ enum HandlePosition {
bool get influencesBottomOrRight =>
this == bottomRight || this == bottom || this == right;

/// Whether the handle is either on the left or right, or any diagonal side
/// of the rect.
bool get influencesHorizontal => isHorizontal || isDiagonal;

/// Whether the handle is either on the top or bottom, or any diagonal side
/// of the rect.
bool get influencesVertical => isVertical || isDiagonal;

/// Whether the handle is on the corner of the rect.
bool get isDiagonal =>
this == topLeft ||
Expand Down
12 changes: 6 additions & 6 deletions packages/box_transform/lib/src/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class BoxTransformer {
initialRect: initialRect,
clampingRect: clampingRect,
constraints: constraints,
delta: delta,
handle: handle,
);

return ResizeResult(
Expand Down Expand Up @@ -203,13 +203,13 @@ class BoxTransformer {
required Box initialRect,
required Box clampingRect,
required Constraints constraints,
required Vector2 delta,
required HandlePosition handle,
}) {
bool minWidthReached = false;
bool maxWidthReached = false;
bool minHeightReached = false;
bool maxHeightReached = false;
if (delta.x != 0) {
if (handle.influencesHorizontal) {
if (rect.width <= initialRect.width &&
rect.width == constraints.minWidth) {
minWidthReached = true;
Expand All @@ -220,14 +220,14 @@ class BoxTransformer {
maxWidthReached = true;
}
}
if (delta.y != 0) {
if (handle.influencesVertical) {
if (rect.height <= initialRect.height &&
rect.height == constraints.minHeight) {
minHeightReached = true;
}
if (rect.height >= initialRect.height &&
rect.height == constraints.maxHeight ||
rect.height == clampingRect.height) {
(rect.height == constraints.maxHeight ||
rect.height == clampingRect.height)) {
maxHeightReached = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_box_transform/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^4.0.0

flutter:
uses-material-design: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
12 changes: 6 additions & 6 deletions packages/flutter_box_transform/playground/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ environment:
dependencies:
flutter:
sdk: flutter
adaptive_theme: ^3.2.1
url_launcher: ^6.1.11
provider: ^6.0.5
adaptive_theme: ^3.6.0
url_launcher: ^6.2.6
provider: ^6.1.2
equatable: ^2.0.5
dart_style: ^2.3.1
dart_style: ^2.3.6
vector_math: ^2.1.4
file_picker: ^5.2.11
file_picker: ^8.0.3
flutter_box_transform:
path: ../

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^4.0.0

flutter:
uses-material-design: true
Expand Down

0 comments on commit c303e57

Please sign in to comment.