more cleanup

This commit is contained in:
randogoth 2025-02-21 23:07:02 +02:00
parent f728cc6e66
commit 05026b3fe2
2 changed files with 0 additions and 51 deletions

View file

@ -1,21 +0,0 @@
import 'dart:io';
class SearchService {
static List<File> searchNotes(String query, List<File> 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));
}
}

View file

@ -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);
});
}