From 05026b3fe230ee91ca209a205bb0dfc90b52896c Mon Sep 17 00:00:00 2001 From: randogoth Date: Fri, 21 Feb 2025 23:07:02 +0200 Subject: [PATCH] more cleanup --- lib/search_service.dart | 21 --------------------- test/widget_test.dart | 30 ------------------------------ 2 files changed, 51 deletions(-) delete mode 100644 lib/search_service.dart delete mode 100644 test/widget_test.dart diff --git a/lib/search_service.dart b/lib/search_service.dart deleted file mode 100644 index 2427041..0000000 --- a/lib/search_service.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'dart:io'; - -class SearchService { - static List searchNotes(String query, List notes) { - if (query.isEmpty) return notes; - - final lowerQuery = query.toLowerCase(); - return notes.where((note) { - final fileName = note.uri.pathSegments.last.replaceAll('.md', '').toLowerCase(); - final content = note.readAsStringSync().toLowerCase(); - - // Fuzzy search: Match if all words in the query are found in either the title or content - return _matchesFuzzy(lowerQuery, fileName) || _matchesFuzzy(lowerQuery, content); - }).toList(); - } - - static bool _matchesFuzzy(String query, String text) { - final words = query.split(RegExp(r'\s+')).where((word) => word.isNotEmpty); - return words.every((word) => text.contains(word)); - } -} \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 9c215b7..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:muzzlevelocity/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}