mixed merge conflicts

This commit is contained in:
ashilkn 2022-08-12 11:30:41 +05:30
commit 7822ed7f68
10 changed files with 171 additions and 124 deletions

View file

@ -353,6 +353,10 @@ extension CustomColorScheme on ColorScheme {
Color get searchResultsColor => brightness == Brightness.light
? const Color.fromRGBO(245, 245, 245, 1.0)
: const Color.fromRGBO(30, 30, 30, 1.0);
Color get searchResultsCountTextColor => brightness == Brightness.light
? const Color.fromRGBO(80, 80, 80, 1)
: const Color.fromRGBO(150, 150, 150, 1);
}
OutlinedButtonThemeData buildOutlinedButtonThemeData({

View file

@ -12,13 +12,12 @@ import 'package:photos/models/location.dart';
import 'package:photos/models/search/location_api_response.dart';
import 'package:photos/models/search/location_search_result.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/services/user_service.dart';
class SearchService {
Future<List<File>> _cachedFilesFuture;
final _dio = Network.instance.getDio();
final _config = Configuration.instance;
final _logger = Logger((UserService).toString());
final _logger = Logger((SearchService).toString());
final _collectionService = CollectionsService.instance;
static const _maximumResultsLimit = 20;

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/models/search/album_search_result.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
import 'package:photos/ui/viewer/gallery/collection_page.dart';
import 'package:photos/ui/viewer/search/search_result_widgets/search_result_thumbnail_widget.dart';
import 'package:photos/utils/navigation_util.dart';
class AlbumSearchResultWidget extends StatelessWidget {
@ -21,66 +21,66 @@ class AlbumSearchResultWidget extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Album',
style: TextStyle(fontSize: 12),
),
const SizedBox(height: 8),
Text(
albumSearchResult.collectionWithThumbnail.collection.name,
style: const TextStyle(fontSize: 18),
overflow: TextOverflow.ellipsis,
),
FutureBuilder<int>(
future: FilesDB.instance.collectionFileCount(
albumSearchResult.collectionWithThumbnail.collection.id,
),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data > 0) {
final noOfMemories = snapshot.data;
return RichText(
text: TextSpan(
style: TextStyle(
color: Theme.of(context)
.colorScheme
.defaultTextColor,
),
children: [
TextSpan(text: noOfMemories.toString()),
TextSpan(
text: noOfMemories != 1
? ' memories'
: ' memory',
),
],
),
);
} else {
return const SizedBox.shrink();
}
},
),
],
),
SearchResultThumbnailWidget(
albumSearchResult.collectionWithThumbnail.thumbnail,
"collection_search",
),
Hero(
tag: "collection_search" +
albumSearchResult.collectionWithThumbnail.thumbnail.tag(),
child: SizedBox(
height: 50,
width: 50,
child: ThumbnailWidget(
albumSearchResult.collectionWithThumbnail.thumbnail,
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Album',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.subTextColor,
),
),
),
)
const SizedBox(height: 4),
Text(
albumSearchResult.collectionWithThumbnail.collection.name,
style: const TextStyle(fontSize: 18),
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 2),
FutureBuilder<int>(
future: FilesDB.instance.collectionFileCount(
albumSearchResult.collectionWithThumbnail.collection.id,
),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data > 0) {
final noOfMemories = snapshot.data;
return RichText(
text: TextSpan(
style: TextStyle(
color: Theme.of(context)
.colorScheme
.searchResultsCountTextColor,
),
children: [
TextSpan(text: noOfMemories.toString()),
TextSpan(
text:
noOfMemories != 1 ? ' memories' : ' memory',
),
],
),
);
} else {
return const SizedBox.shrink();
}
},
),
],
),
const Spacer(),
Icon(
Icons.chevron_right,
color: Theme.of(context).colorScheme.subTextColor,
),
],
),
),

View file

@ -3,7 +3,7 @@ import 'package:photos/ente_theme_data.dart';
import 'package:photos/models/file.dart';
import 'package:photos/models/search/file_search_result.dart';
import 'package:photos/ui/viewer/file/detail_page.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
import 'package:photos/ui/viewer/search/search_result_widgets/search_result_thumbnail_widget.dart';
import 'package:photos/utils/navigation_util.dart';
class FileSearchResultWidget extends StatelessWidget {
@ -19,34 +19,39 @@ class FileSearchResultWidget extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'File',
style: TextStyle(fontSize: 12),
SearchResultThumbnailWidget(
matchedFile.file,
"file_details",
),
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'File',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.subTextColor,
),
const SizedBox(height: 8),
Text(
),
const SizedBox(height: 6),
SizedBox(
width: 220,
child: Text(
matchedFile.file.title,
style: const TextStyle(fontSize: 18),
overflow: TextOverflow.ellipsis,
),
const Text('1 memory')
],
),
),
],
),
Hero(
tag: "file_details" + matchedFile.file.tag(),
child: SizedBox(
height: 50,
width: 50,
child: ThumbnailWidget(matchedFile.file),
),
const Spacer(),
Icon(
Icons.chevron_right,
color: Theme.of(context).colorScheme.subTextColor,
),
],
),

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/models/search/location_search_result.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
import 'package:photos/ui/viewer/search/collections/files_in_location_page.dart';
import 'package:photos/ui/viewer/search/search_result_widgets/search_result_thumbnail_widget.dart';
import 'package:photos/utils/navigation_util.dart';
class LocationSearchResultWidget extends StatelessWidget {
@ -24,46 +24,52 @@ class LocationSearchResultWidget extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Location',
style: TextStyle(fontSize: 12),
),
const SizedBox(height: 8),
Text(
locationSearchResult.location,
style: const TextStyle(fontSize: 18),
overflow: TextOverflow.ellipsis,
),
RichText(
text: TextSpan(
style: TextStyle(
color: Theme.of(context).colorScheme.defaultTextColor,
),
children: [
TextSpan(text: noOfMemories.toString()),
TextSpan(
text: noOfMemories != 1 ? ' memories' : ' memory',
),
],
),
),
],
),
SearchResultThumbnailWidget(
locationSearchResult.files[0],
heroTagPrefix,
),
Hero(
tag: heroTagPrefix + locationSearchResult.files[0].tag(),
child: SizedBox(
height: 50,
width: 50,
child: ThumbnailWidget(locationSearchResult.files[0]),
),
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Location',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.subTextColor,
),
),
const SizedBox(height: 6),
Text(
locationSearchResult.location,
style: const TextStyle(fontSize: 18),
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 2),
RichText(
text: TextSpan(
style: TextStyle(
color: Theme.of(context)
.colorScheme
.searchResultsCountTextColor,
),
children: [
TextSpan(text: noOfMemories.toString()),
TextSpan(
text: noOfMemories != 1 ? ' memories' : ' memory',
),
],
),
),
],
),
const Spacer(),
Icon(
Icons.chevron_right,
color: Theme.of(context).colorScheme.subTextColor,
),
],
),

View file

@ -0,0 +1,31 @@
import 'package:flutter/widgets.dart';
import 'package:photos/models/file.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
class SearchResultThumbnailWidget extends StatelessWidget {
final File file;
final String tagPrefix;
const SearchResultThumbnailWidget(
this.file,
this.tagPrefix, {
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Hero(
tag: tagPrefix + file.tag(),
child: SizedBox(
height: 58,
width: 58,
child: ClipRRect(
borderRadius: BorderRadius.circular(3),
child: ThumbnailWidget(
file,
),
),
),
);
}
}

View file

@ -22,8 +22,10 @@ class SearchSuggestionsWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: Colors.transparent,
color: Theme.of(context).colorScheme.searchResultsColor,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
@ -36,11 +38,12 @@ class SearchSuggestionsWidget extends StatelessWidget {
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Container(
margin: const EdgeInsets.only(top: 8),
margin: const EdgeInsets.only(top: 6),
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.5,
),
child: ListView.builder(
physics: const ClampingScrollPhysics(),
shrinkWrap: true,
itemCount: results.length + 1,
itemBuilder: (context, index) {

View file

@ -65,7 +65,7 @@ class _SearchWidgetState extends State<SearchWidget> {
child: TextFormField(
style: Theme.of(context).textTheme.subtitle1,
decoration: InputDecoration(
hintText: 'Search for albums, locations & files',
hintText: 'Search for albums, places & files',
filled: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
@ -146,7 +146,6 @@ class _SearchWidgetState extends State<SearchWidget> {
for (LocationSearchResult result in locationResults) {
allResults.add(result);
}
final fileResults =
await SearchService.instance.getFileSearchResults(query);
for (File file in fileResults) {

View file

@ -77,7 +77,7 @@ class TransparentRoute extends PageRoute<void> {
bool get maintainState => true;
@override
Duration get transitionDuration => const Duration(milliseconds: 350);
Duration get transitionDuration => const Duration(milliseconds: 200);
@override
Widget buildPage(

View file

@ -11,7 +11,7 @@ description: ente photos application
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.6.20+350
version: 0.6.23+353
environment:
sdk: ">=2.10.0 <3.0.0"