Skip to content

Commit

Permalink
v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusrp98 committed Feb 2, 2023
1 parent 24c68e5 commit 9594022
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 45 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2.3.0] - February 2nd, 2023

- Update default search page style to match Material 3.
- Add `very_good_analysis` package.

## [2.2.0] - September 13rd, 2022

- Add ability to sort results in search page.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Search Page

[![Package](https://img.shields.io/pub/v/search_page.svg?style=for-the-badge)](https://pub.dartlang.org/packages/search_page)
[![Build](https://img.shields.io/github/workflow/status/jesusrp98/search_page/Flutter%20Package%20CI?style=for-the-badge)](https://github.com/jesusrp98/search_page/actions)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg?style=for-the-badge)](https://pub.dev/packages/very_good_analysis)
[![Build](https://img.shields.io/github/actions/workflow/status/jesusrp98/search_page/flutter_package.yml?branch=master&style=for-the-badge)](https://github.com/jesusrp98/search_page/actions)
[![Patreon](https://img.shields.io/badge/Support-Patreon-orange.svg?style=for-the-badge)](https://www.patreon.com/jesusrp98)
[![License](https://img.shields.io/github/license/jesusrp98/search_page.svg?style=for-the-badge)](https://www.gnu.org/licenses/gpl-3.0.en.html)

Expand Down
6 changes: 3 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include: package:flutter_lints/flutter.yaml

include: package:very_good_analysis/analysis_options.yaml
linter:
rules:
require_trailing_commas: true
public_member_api_docs: false
sort_constructors_first: false
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'search_page',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
),
home: const MyHomePage(),
);
Expand Down
18 changes: 4 additions & 14 deletions lib/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ typedef SortCallback<T> = int Function(T a, T b);
/// It can show suggestion & unsuccessful-search widgets.
class SearchPage<T> extends SearchDelegate<T?> {
/// Set this to true to display the complete list instead of the [suggestion].
/// This is useful to give your users the chance to explore all the items in the
/// list without knowing what so search for.
/// This is useful to give your users the chance to explore all the items in
/// the list without knowing what so search for.
final bool showItemsOnEmpty;

/// Widget that is built when current query is empty.
Expand Down Expand Up @@ -91,17 +91,7 @@ class SearchPage<T> extends SearchDelegate<T?> {
ThemeData appBarTheme(BuildContext context) {
return barTheme ??
Theme.of(context).copyWith(
textTheme: Theme.of(context).textTheme.copyWith(
headline6: TextStyle(
color: Theme.of(context).primaryTextTheme.headline6?.color,
fontSize: 20,
),
),
inputDecorationTheme: InputDecorationTheme(
hintStyle: TextStyle(
color: Theme.of(context).primaryTextTheme.caption?.color,
fontSize: 20,
),
inputDecorationTheme: const InputDecorationTheme(
focusedErrorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
Expand Down Expand Up @@ -164,7 +154,7 @@ class SearchPage<T> extends SearchDelegate<T?> {
@override
Widget buildSuggestions(BuildContext context) {
// Calles the 'onQueryUpdated' functions at the start of the operation
if (onQueryUpdate != null) onQueryUpdate!(query);
onQueryUpdate?.call(query);

// Deletes possible blank spaces & converts the string to lower case
final cleanQuery = query.toLowerCase().trim();
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: search_page
description: Fast and easy way to build a custom search experience in you app
version: 2.2.0
version: 2.3.0
homepage: https://github.com/jesusrp98/search_page

environment:
Expand All @@ -14,4 +14,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
very_good_analysis: '>=3.0.0 <4.0.0'
46 changes: 22 additions & 24 deletions test/search_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:search_page/search_page.dart';
const List<String> _mockList = ['a', 'b', 'c', 'dd', 'ee', 'ff'];

class TestPage extends StatelessWidget {
final SearchDelegate delegate;
final SearchDelegate<String?> delegate;

const TestPage(this.delegate, {super.key});

Expand All @@ -21,12 +21,10 @@ class TestPage extends StatelessWidget {
IconButton(
tooltip: 'Search',
icon: const Icon(Icons.search),
onPressed: () async {
showSearch<String?>(
context: context,
delegate: delegate as SearchDelegate<String?>,
);
},
onPressed: () => showSearch(
context: context,
delegate: delegate,
),
),
],
),
Expand All @@ -45,7 +43,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -84,7 +82,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -116,7 +114,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -153,7 +151,7 @@ void main() {
showItemsOnEmpty: true,
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -199,7 +197,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand All @@ -221,7 +219,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -256,7 +254,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -290,7 +288,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
searchLabel: searchHint,
);

Expand All @@ -317,7 +315,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -374,7 +372,7 @@ void main() {
expect(find.byType(ListTile), findsNothing);
});

testWidgets('Null strings aren\'t an issue', (tester) async {
testWidgets("Null strings aren't an issue", (tester) async {
// Added a new fiter which uses the length of the string
final searchPage = SearchPage<String?>(
items: [..._mockList, null],
Expand Down Expand Up @@ -420,7 +418,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand All @@ -447,7 +445,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -475,7 +473,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -505,7 +503,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -535,7 +533,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -596,7 +594,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down Expand Up @@ -649,7 +647,7 @@ void main() {
suggestion: const Text('Suggestion text'),
failure: const Text('Failure text'),
filter: (string) => [string],
builder: (string) => Text(string),
builder: Text.new,
);

await tester.pumpWidget(
Expand Down

0 comments on commit 9594022

Please sign in to comment.