Skip to content

Commit

Permalink
refactor: clean up some of the example code
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryConrad committed Jan 18, 2023
1 parent d5a92ec commit 23a9a2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
24 changes: 10 additions & 14 deletions packages/flutter_mimir/example/lib/main.dart
Expand Up @@ -85,21 +85,17 @@ class Body extends HookConsumerWidget {
),
),
),
body: Column(children: [
Expanded(
child: searchResults.when(
data: (searchResults) => ListView.builder(
padding: const EdgeInsets.only(top: 16, bottom: 8),
itemCount: searchResults.length,
itemBuilder: (_, index) => MovieCard(movie: searchResults[index]),
),
error: (e, s) => Center(child: Text('Error: $e')),
loading: () => const Center(
child: CircularProgressIndicator.adaptive(),
),
),
body: searchResults.when(
data: (searchResults) => ListView.builder(
padding: const EdgeInsets.only(top: 16, bottom: 8),
itemCount: searchResults.length,
itemBuilder: (_, index) => MovieCard(movie: searchResults[index]),
),
]),
error: (e, s) => Center(child: Text('Error: $e')),
loading: () => const Center(
child: CircularProgressIndicator.adaptive(),
),
),
);
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/mimir/example/lib/example.dart
Expand Up @@ -74,8 +74,7 @@ Future<void> run(String path, DynamicLibrary lib) async {
// Let's sort the results by year in descending order here (new to old):
SortBy.desc('year'),
// If any two movies had the same year, we could sort by title next:
// To enable sorting by title, add it to the sortableFields above
// SortBy.asc('title'),
SortBy.asc('title'),
],
);

Expand Down

0 comments on commit 23a9a2e

Please sign in to comment.