refactor contaienr filter
This commit is contained in:
+5
-1
@@ -40,7 +40,11 @@ class TabSearch extends HookConsumerWidget {
|
|||||||
seamlessFilteredTabPreviewsProvider(
|
seamlessFilteredTabPreviewsProvider(
|
||||||
TabSearchPartition.search,
|
TabSearchPartition.search,
|
||||||
// ignore: provider_parameters
|
// ignore: provider_parameters
|
||||||
ContainerFilter.from(selectedContainer.value?.id),
|
selectedContainer.value?.id.mapNotNull(
|
||||||
|
(containerId) =>
|
||||||
|
ContainerFilterById(containerId: containerId),
|
||||||
|
) ??
|
||||||
|
ContainerFilterDisabled(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.value;
|
.value;
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
import 'package:fast_equatable/fast_equatable.dart';
|
import 'package:fast_equatable/fast_equatable.dart';
|
||||||
|
|
||||||
sealed class ContainerFilter with FastEquatable {
|
sealed class ContainerFilter with FastEquatable {}
|
||||||
ContainerFilter();
|
|
||||||
|
|
||||||
factory ContainerFilter.from(String? containerId) {
|
|
||||||
return (containerId != null)
|
|
||||||
? ContainerFilterById(containerId: containerId)
|
|
||||||
: ContainerFilterDisabled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ContainerFilterById extends ContainerFilter {
|
class ContainerFilterById extends ContainerFilter {
|
||||||
final String? containerId;
|
final String? containerId;
|
||||||
|
|||||||
@@ -144,8 +144,10 @@ Stream<ContainerData?> selectedContainerData(Ref ref) {
|
|||||||
AsyncValue<int> selectedContainerTabCount(Ref ref) {
|
AsyncValue<int> selectedContainerTabCount(Ref ref) {
|
||||||
final selectedContainer = ref.watch(selectedContainerProvider);
|
final selectedContainer = ref.watch(selectedContainerProvider);
|
||||||
final tabCount = ref.watch(
|
final tabCount = ref.watch(
|
||||||
// ignore: provider_parameters
|
containerTabCountProvider(
|
||||||
containerTabCountProvider(ContainerFilter.from(selectedContainer)),
|
// ignore: provider_parameters
|
||||||
|
ContainerFilterById(containerId: selectedContainer),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return tabCount;
|
return tabCount;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ final selectedContainerDataProvider =
|
|||||||
// ignore: unused_element
|
// ignore: unused_element
|
||||||
typedef SelectedContainerDataRef = AutoDisposeStreamProviderRef<ContainerData?>;
|
typedef SelectedContainerDataRef = AutoDisposeStreamProviderRef<ContainerData?>;
|
||||||
String _$selectedContainerTabCountHash() =>
|
String _$selectedContainerTabCountHash() =>
|
||||||
r'60218b4a9058738dfd43628d5e3c55f93080732f';
|
r'0fd457793f7870050f81c54d2fbcc81aca60f394';
|
||||||
|
|
||||||
/// See also [selectedContainerTabCount].
|
/// See also [selectedContainerTabCount].
|
||||||
@ProviderFor(selectedContainerTabCount)
|
@ProviderFor(selectedContainerTabCount)
|
||||||
|
|||||||
Reference in New Issue
Block a user