refactor draggable
This commit is contained in:
+20
-25
@@ -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,24 +59,20 @@ class _TabDraggable extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return CustomDraggable(
|
return switch (dragData) {
|
||||||
key: Key(entity.tabId),
|
ContainerDropData() => Opacity(
|
||||||
data: TabDragData(entity.tabId),
|
opacity: 0.3,
|
||||||
child: switch (dragData) {
|
child: Transform.scale(scale: 0.9, child: tab),
|
||||||
ContainerDropData() => Opacity(
|
),
|
||||||
opacity: 0.3,
|
DeleteDropData() => Opacity(
|
||||||
child: Transform.scale(scale: 0.9, child: tab),
|
opacity: 0.3,
|
||||||
|
child: ColorFiltered(
|
||||||
|
colorFilter: const ColorFilter.mode(Colors.red, BlendMode.modulate),
|
||||||
|
child: tab,
|
||||||
),
|
),
|
||||||
DeleteDropData() => Opacity(
|
),
|
||||||
opacity: 0.3,
|
null => tab,
|
||||||
child: ColorFiltered(
|
};
|
||||||
colorFilter: const ColorFilter.mode(Colors.red, BlendMode.modulate),
|
|
||||||
child: tab,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
null => tab,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,10 +375,13 @@ 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),
|
||||||
entity: entity,
|
data: TabDragData(entity.tabId),
|
||||||
onClose: onClose,
|
child: _TabDraggable(
|
||||||
|
entity: entity,
|
||||||
|
onClose: onClose,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user