Skip to content

Commit

Permalink
Fix widgets being draggable while resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Dec 17, 2023
1 parent 46acf68 commit 871d547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ class DraggableWidgetContainer extends StatelessWidget {
rect: draggingRect,
clampingRect:
const Rect.fromLTWH(0, 0, double.infinity, double.infinity),
constraints: const BoxConstraints(
minWidth: 128.0,
minHeight: 128.0,
),
resizeModeResolver: () => ResizeMode.freeform,
allowFlippingWhileResizing: false,
handleTapSize: 12,
Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/tab_grid.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';

import 'package:dot_cast/dot_cast.dart';
Expand Down Expand Up @@ -275,8 +277,8 @@ class TabGrid extends StatelessWidget {
Rect preview = Rect.fromLTWH(
previewX, previewY, previewWidth.toDouble(), previewHeight.toDouble());

double newWidth = newRect.width.clamp(widget.minWidth, double.infinity);
double newHeight = newRect.height.clamp(widget.minHeight, double.infinity);
double newWidth = max(newRect.width, widget.minWidth);
double newHeight = max(newRect.height, widget.minHeight);

widget.draggingRect =
Rect.fromLTWH(newRect.left, newRect.top, newWidth, newHeight);
Expand Down

0 comments on commit 871d547

Please sign in to comment.