mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
committed by
GitHub
parent
1091fb1f33
commit
a0d314bf5e
@@ -9,6 +9,17 @@ bool matchesQuery(String query, String sampleAttributes) {
|
||||
var queryWords = query.split(' ')..removeWhere((s) => s.isEmpty);
|
||||
var attributes = sampleAttributes.split(' ')..removeWhere((s) => s.isEmpty);
|
||||
|
||||
// Test for type filter
|
||||
// This will check whether a type parameter is present in the
|
||||
// search query, and return false if the self type mismatches
|
||||
// the query type
|
||||
for (var word in queryWords) {
|
||||
if ((word.contains('type:') && !attributes.contains(word)) ||
|
||||
(word.contains('platform:') && !attributes.contains('type:demo'))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Test for exact matches
|
||||
if (attributes.contains(query)) {
|
||||
return true;
|
||||
|
||||
@@ -107,7 +107,8 @@ void main() {
|
||||
'widget:AnimatedBuilder '
|
||||
'widget:FutureBuilder '
|
||||
'package:json_serializable '
|
||||
'package:path';
|
||||
'package:path '
|
||||
'type:sample';
|
||||
|
||||
// Test if various queries match these attributes
|
||||
expect(matchesQuery('foo', attributes), false);
|
||||
@@ -124,6 +125,11 @@ void main() {
|
||||
expect(matchesQuery('kitten tag:cats', attributes), true);
|
||||
expect(matchesQuery('tag:beginner dogs', attributes), false);
|
||||
expect(matchesQuery('asdf ', attributes), false);
|
||||
|
||||
// Test if queries match by type
|
||||
expect(matchesQuery('type:sample', attributes), true);
|
||||
expect(matchesQuery('type:cookbook', attributes), false);
|
||||
expect(matchesQuery('kittens type:cookbook', attributes), false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,10 @@ void deploy() {
|
||||
@Depends(createThumbnails)
|
||||
Future buildRelease() async {
|
||||
var app = PubApp.local('build_runner');
|
||||
await app.runAsync('build --release --output web:public --delete-conflicting-outputs'.split(' ').toList());
|
||||
await app.runAsync(
|
||||
'build --release --output web:public --delete-conflicting-outputs'
|
||||
.split(' ')
|
||||
.toList());
|
||||
}
|
||||
|
||||
@DefaultTask('Build the project.')
|
||||
|
||||
@@ -5,6 +5,5 @@ import 'package:mdc_web/mdc_web.dart';
|
||||
InputElement searchInput;
|
||||
|
||||
void main() {
|
||||
querySelectorAll('.mdc-card__primary-action')
|
||||
.forEach((el) => MDCRipple(el));
|
||||
querySelectorAll('.mdc-card__primary-action').forEach((el) => MDCRipple(el));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user