Remove padding from Draggable

This commit is contained in:
Ming Ming 2024-10-20 18:36:32 +08:00
parent b871fdf49b
commit d73fd18294
2 changed files with 25 additions and 24 deletions

View file

@ -113,9 +113,13 @@ class _EditContentList extends StatelessWidget {
.getThumbSize(zoomLevel.requireData)
.toDouble(),
items: state.editTransformedItems ?? state.transformedItems,
itemBuilder: (context, _, item) => item.buildWidget(context),
itemBuilder: (context, _, item) => Padding(
padding: const EdgeInsets.all(8),
child: item.buildWidget(context),
),
itemDragFeedbackBuilder: (context, _, item) =>
item.buildDragFeedbackWidget(context),
item.buildDragFeedbackWidget(context) ??
item.buildWidget(context),
staggeredTileBuilder: (_, item) => item.staggeredTile,
onDragResult: (results) {
context.addEvent(_EditManualSort(results));

View file

@ -41,32 +41,29 @@ class Draggable<T extends Object> extends StatelessWidget {
return Stack(
fit: StackFit.expand,
children: [
Padding(
padding: const EdgeInsets.all(8),
child: LongPressDraggable<T>(
data: data,
dragAnchorStrategy: pointerDragAnchorStrategy,
onDragStarted: onDragStarted,
onDragEnd: (_) => onDragEndedAny?.call(),
onDragCompleted: onDragEndedAny,
onDraggableCanceled: (v, o) => onDragEndedAny?.call(),
feedback: FractionalTranslation(
translation: const Offset(-.5, -.5),
child: SizedBox(
width: feedbackSize?.width ?? 128,
height: feedbackSize?.height ?? 128,
child: Opacity(
opacity: .5,
child: feedback ?? child,
),
LongPressDraggable<T>(
data: data,
dragAnchorStrategy: pointerDragAnchorStrategy,
onDragStarted: onDragStarted,
onDragEnd: (_) => onDragEndedAny?.call(),
onDragCompleted: onDragEndedAny,
onDraggableCanceled: (v, o) => onDragEndedAny?.call(),
feedback: FractionalTranslation(
translation: const Offset(-.5, -.5),
child: SizedBox(
width: feedbackSize?.width ?? 128,
height: feedbackSize?.height ?? 128,
child: Opacity(
opacity: .5,
child: feedback ?? child,
),
),
childWhenDragging: Opacity(
opacity: .25,
child: child,
),
),
childWhenDragging: Opacity(
opacity: .25,
child: child,
),
child: child,
),
if (onDropBefore != null || onDropAfter != null)
Positioned.fill(