Skip to content

Commit

Permalink
docs: rewrite flutter example with rearch (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryConrad authored Jul 12, 2023
1 parent 0fe7d88 commit 2b604b6
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 278 deletions.
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions packages/flutter_mimir/example/README.md

This file was deleted.

29 changes: 0 additions & 29 deletions packages/flutter_mimir/example/analysis_options.yaml

This file was deleted.

27 changes: 4 additions & 23 deletions packages/flutter_mimir/example/integration_test/movies_test.dart
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mimir_example/main.dart';
import 'package:flutter_mimir/flutter_mimir.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

Future<void> pause() => Future.delayed(const Duration(milliseconds: 500));

void main() {
TestWidgetsFlutterBinding.ensureInitialized();

testWidgets('Searching returns expected titles', (tester) async {
Future<void> search(String text) async {
await tester.enterText(find.byType(TextField), text);
await tester.pump();
await pause();
await tester.pump();
await tester.pumpAndSettle();
}

final instance = await Mimir.defaultInstance;
final index = instance.getIndex('movies');

await rootBundle
.loadString('assets/tmdb_movies.json')
.then((l) => json.decode(l) as List)
.then((l) => l.cast<Map<String, dynamic>>())
.then((l) => index.addDocuments(l));

await tester.pumpWidget(ProviderScope(
overrides: [indexProvider.overrideWith((_) => index)],
child: const MaterialApp(home: Body()),
));
// Wait for inital load to finish
await tester.pumpWidget(const DemoApp());
await tester.pumpAndSettle();

// When no search text, Godzilla vs. Kong is the first entry
await search('');
Expand Down
Loading

0 comments on commit 2b604b6

Please sign in to comment.