Skip to content

Commit 1451ea7

Browse files
committed
Update collection_pane.dart
1 parent 77cb9db commit 1451ea7

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

lib/screens/home_page/collection_pane.dart

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ class CollectionPane extends ConsumerWidget {
9393
style: Theme.of(context).textTheme.bodyMedium,
9494
hintText: "Filter by name or URL",
9595
onChanged: (value) {
96-
if (value.trim().isNotEmpty) {
97-
ref.read(searchQueryProvider.notifier).state = value;
98-
print(value);
99-
}
96+
ref.read(searchQueryProvider.notifier).state = value;
10097
},
10198
),
10299
),
@@ -143,41 +140,44 @@ class _RequestListState extends ConsumerState<RequestList> {
143140
final requestItems = ref.watch(collectionStateNotifierProvider)!;
144141
final alwaysShowCollectionPaneScrollbar = ref.watch(settingsProvider
145142
.select((value) => value.alwaysShowCollectionPaneScrollbar));
143+
final filterQuery = ref.watch(searchQueryProvider).trim();
146144

147145
return Scrollbar(
148146
controller: controller,
149147
thumbVisibility: alwaysShowCollectionPaneScrollbar ? true : null,
150148
radius: const Radius.circular(12),
151-
child: ReorderableListView.builder(
152-
padding: kPr8CollectionPane,
153-
scrollController: controller,
154-
buildDefaultDragHandles: false,
155-
itemCount: requestItems.length,
156-
onReorder: (int oldIndex, int newIndex) {
157-
if (oldIndex < newIndex) {
158-
newIndex -= 1;
159-
}
160-
if (oldIndex != newIndex) {
161-
ref
162-
.read(collectionStateNotifierProvider.notifier)
163-
.reorder(oldIndex, newIndex);
164-
}
165-
},
166-
itemBuilder: (context, index) {
167-
var id = requestSequence[index];
168-
return ReorderableDragStartListener(
169-
key: ValueKey(id),
170-
index: index,
171-
child: Padding(
172-
padding: kP1,
173-
child: RequestItem(
174-
id: id,
175-
requestModel: requestItems[id]!,
176-
),
177-
),
178-
);
179-
},
180-
),
149+
child: filterQuery.isEmpty
150+
? ReorderableListView.builder(
151+
padding: kPr8CollectionPane,
152+
scrollController: controller,
153+
buildDefaultDragHandles: false,
154+
itemCount: requestItems.length,
155+
onReorder: (int oldIndex, int newIndex) {
156+
if (oldIndex < newIndex) {
157+
newIndex -= 1;
158+
}
159+
if (oldIndex != newIndex) {
160+
ref
161+
.read(collectionStateNotifierProvider.notifier)
162+
.reorder(oldIndex, newIndex);
163+
}
164+
},
165+
itemBuilder: (context, index) {
166+
var id = requestSequence[index];
167+
return ReorderableDragStartListener(
168+
key: ValueKey(id),
169+
index: index,
170+
child: Padding(
171+
padding: kP1,
172+
child: RequestItem(
173+
id: id,
174+
requestModel: requestItems[id]!,
175+
),
176+
),
177+
);
178+
},
179+
)
180+
: SizedBox(),
181181
);
182182
}
183183
}

0 commit comments

Comments
 (0)