diff --git a/lib/app/categories/selectors/category_multi_selector.dart b/lib/app/categories/selectors/category_multi_selector.dart index 4b3e0e48..8e612687 100644 --- a/lib/app/categories/selectors/category_multi_selector.dart +++ b/lib/app/categories/selectors/category_multi_selector.dart @@ -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'; @@ -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, @@ -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: [