Skip to content

Commit

Permalink
fix: Category multi-selector not filtering registers
Browse files Browse the repository at this point in the history
  • Loading branch information
enrique-lozano committed Aug 2, 2024
1 parent bc6c3e2 commit 55cc7be
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/app/categories/selectors/category_multi_selector.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:collection/collection.dart';
import 'package:drift/drift.dart' as drift;
import 'package:flutter/material.dart';
import 'package:monekin/core/database/services/category/category_service.dart';
import 'package:monekin/core/extensions/string.extension.dart';
Expand Down Expand Up @@ -60,10 +61,24 @@ class _CategoryMultiSelectorModalState
super.dispose();
}

_moveSheetTo(double position) {
if (controller.isAttached && mounted) {
controller.jumpTo(position);
}
}

@override
Widget build(BuildContext context) {
final t = Translations.of(context);

final bottomInsets = MediaQuery.of(context).viewInsets.bottom;

if (bottomInsets > 0) {
_moveSheetTo(1);
} else {
_moveSheetTo(0.65);
}

return DraggableScrollableSheet(
controller: controller,
expand: false,
Expand All @@ -86,7 +101,10 @@ class _CategoryMultiSelectorModalState
);
},
body: StreamBuilder(
stream: CategoryService.instance.getCategories(),
stream: CategoryService.instance.getCategories(
predicate: (c, pc) =>
c.name.contains(searchValue) |
pc.name.contains(searchValue)),
builder: (context, snapshot) {
return Column(
children: [
Expand Down

0 comments on commit 55cc7be

Please sign in to comment.