refactor draggable
This commit is contained in:
+7
-12
@@ -30,11 +30,7 @@ class _TabDraggable extends HookConsumerWidget {
|
|||||||
final TabEntity entity;
|
final TabEntity entity;
|
||||||
final VoidCallback onClose;
|
final VoidCallback onClose;
|
||||||
|
|
||||||
const _TabDraggable({
|
const _TabDraggable({required this.entity, required this.onClose});
|
||||||
required super.key,
|
|
||||||
required this.entity,
|
|
||||||
required this.onClose,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -63,10 +59,7 @@ class _TabDraggable extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return CustomDraggable(
|
return switch (dragData) {
|
||||||
key: Key(entity.tabId),
|
|
||||||
data: TabDragData(entity.tabId),
|
|
||||||
child: switch (dragData) {
|
|
||||||
ContainerDropData() => Opacity(
|
ContainerDropData() => Opacity(
|
||||||
opacity: 0.3,
|
opacity: 0.3,
|
||||||
child: Transform.scale(scale: 0.9, child: tab),
|
child: Transform.scale(scale: 0.9, child: tab),
|
||||||
@@ -79,8 +72,7 @@ class _TabDraggable extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
null => tab,
|
null => tab,
|
||||||
},
|
};
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,11 +375,14 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
|||||||
return filteredTabEntities.value
|
return filteredTabEntities.value
|
||||||
.where((entity) => entity is! TabTreeEntity)
|
.where((entity) => entity is! TabTreeEntity)
|
||||||
.map(
|
.map(
|
||||||
(entity) => _TabDraggable(
|
(entity) => CustomDraggable(
|
||||||
key: Key(entity.tabId),
|
key: Key(entity.tabId),
|
||||||
|
data: TabDragData(entity.tabId),
|
||||||
|
child: _TabDraggable(
|
||||||
entity: entity,
|
entity: entity,
|
||||||
onClose: onClose,
|
onClose: onClose,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
}, [filteredTabEntities]);
|
}, [filteredTabEntities]);
|
||||||
|
|||||||
Reference in New Issue
Block a user