fixed search result page

This commit is contained in:
Thibault Deckers 2019-12-23 20:15:38 +09:00
parent 4761e16208
commit f965e329ad
3 changed files with 41 additions and 19 deletions

View file

@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28 // latest (or latest-1 if the sources of latest SDK are unavailable)
compileSdkVersion 29 // latest (or latest-1 if the sources of latest SDK are unavailable)
lintOptions {
disable 'InvalidPackage'
@ -34,7 +34,7 @@ android {
defaultConfig {
applicationId "deckers.thibault.aves"
minSdkVersion 24
targetSdkVersion 28 // same as compileSdkVersion
targetSdkVersion 29 // same as compileSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -7,22 +7,22 @@
android:name="io.flutter.app.FlutterApplication"
android:label="Aves"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDf-1dN6JivrQGKSmxAdxERLM2egOvzGWs"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/AppTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="false" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="false" />
</activity>
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDf-1dN6JivrQGKSmxAdxERLM2egOvzGWs" />
</application>
</manifest>

View file

@ -1,6 +1,7 @@
import 'package:aves/model/image_collection.dart';
import 'package:aves/model/image_entry.dart';
import 'package:aves/widgets/album/thumbnail_collection.dart';
import 'package:aves/widgets/common/media_query_data_provider.dart';
import 'package:flutter/material.dart';
class ImageSearchDelegate extends SearchDelegate<ImageEntry> {
@ -54,19 +55,40 @@ class ImageSearchDelegate extends SearchDelegate<ImageEntry> {
final lowerQuery = query.toLowerCase();
final matches = collection.sortedEntries.where((entry) => entry.search(lowerQuery)).toList();
if (matches.isEmpty) {
return Center(
child: Text(
'No match',
textAlign: TextAlign.center,
),
);
return _EmptyContent();
}
return ThumbnailCollection(
return MediaQueryDataProvider(
child: ThumbnailCollection(
collection: ImageCollection(
entries: matches,
groupFactor: collection.groupFactor,
sortFactor: collection.sortFactor,
),
),
);
}
}
class _EmptyContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
const color = Color(0xFF607D8B);
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(
Icons.photo,
size: 64,
color: color,
),
SizedBox(height: 16),
Text(
'No match',
style: TextStyle(color: color),
),
],
),
);
}
}