rename files to follow naming convention

This commit is contained in:
ashilkn 2022-07-25 15:54:06 +05:30
parent 5ecda81dbd
commit 1eae826f60
7 changed files with 3 additions and 222 deletions

View file

@ -6,7 +6,7 @@ import 'package:photos/ente_theme_data.dart';
import 'package:photos/events/sync_status_update_event.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/ui/header_error_widget.dart';
import 'package:photos/ui/viewer/search/searchWidget.dart';
import 'package:photos/ui/viewer/search/search_widget.dart';
const double kContainerHeight = 36;

View file

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/ente_theme_data.dart';

View file

@ -1,69 +0,0 @@
import 'package:flutter/material.dart';
import 'package:photos/models/file.dart';
import 'package:photos/models/location.dart';
import 'package:photos/models/selected_files.dart';
import 'package:photos/ui/viewer/gallery/gallery.dart';
class ViewPort {
final Location northEast;
final Location southWest;
ViewPort(this.northEast, this.southWest);
@override
String toString() => 'ViewPort(northEast: $northEast, southWest: $southWest)';
}
class LocationSearchResultsPage extends StatefulWidget {
final ViewPort viewPort;
final String name;
const LocationSearchResultsPage(this.viewPort, this.name, {Key key})
: super(key: key);
@override
State<LocationSearchResultsPage> createState() =>
_LocationSearchResultsPageState();
}
class _LocationSearchResultsPageState extends State<LocationSearchResultsPage> {
final _selectedFiles = SelectedFiles();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.name),
),
body: Gallery(
tagPrefix: "location_search",
selectedFiles: _selectedFiles,
footer: const SizedBox(height: 120),
),
);
}
List<File> _getResult() {
List<File> files = [];
final Map<String, dynamic> args = <String, dynamic>{};
args['files'] = files;
args['viewPort'] = widget.viewPort;
return _filterPhotos(args);
}
static List<File> _filterPhotos(Map<String, dynamic> args) {
List<File> files = args['files'];
ViewPort viewPort = args['viewPort'];
final result = <File>[];
for (final file in files) {
if (file.location != null &&
viewPort.northEast.latitude > file.location.latitude &&
viewPort.southWest.latitude < file.location.latitude &&
viewPort.northEast.longitude > file.location.longitude &&
viewPort.southWest.longitude < file.location.longitude) {
result.add(file);
} else {}
}
return result;
}
}

View file

@ -1,121 +0,0 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/network.dart';
import 'package:photos/models/location.dart';
import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/viewer/search/location_search_results_page.dart';
class LocationSearchWidget extends StatefulWidget {
const LocationSearchWidget({
Key key,
}) : super(key: key);
@override
State<LocationSearchWidget> createState() => _LocationSearchWidgetState();
}
class _LocationSearchWidgetState extends State<LocationSearchWidget> {
String _searchString;
@override
Widget build(BuildContext context) {
return TypeAheadField(
textFieldConfiguration: const TextFieldConfiguration(
autofocus: true,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Eg: Rome, Paris, New York',
contentPadding: EdgeInsets.all(0.0),
),
),
hideOnEmpty: true,
loadingBuilder: (context) {
return const EnteLoadingWidget();
},
suggestionsCallback: (pattern) async {
if (pattern.isEmpty || pattern.length < 2) {
return null;
}
_searchString = pattern;
return Network.instance
.getDio()
.get(
Configuration.instance.getHttpEndpoint() + "/search/location",
queryParameters: {
"query": pattern,
},
options: Options(
headers: {"X-Auth-Token": Configuration.instance.getToken()},
),
)
.then((response) {
if (_searchString == pattern) {
// Query has not changed
return response.data["results"];
}
return null;
});
},
itemBuilder: (context, suggestion) {
return LocationSearchResultWidget(suggestion['name']);
},
onSuggestionSelected: (suggestion) {
Navigator.pop(context);
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => LocationSearchResultsPage(
ViewPort(
Location(
suggestion['geometry']['viewport']['northeast']['lat'],
suggestion['geometry']['viewport']['northeast']['lng'],
),
Location(
suggestion['geometry']['viewport']['southwest']['lat'],
suggestion['geometry']['viewport']['southwest']['lng'],
),
),
suggestion['name'],
),
),
);
},
);
}
}
class LocationSearchResultWidget extends StatelessWidget {
final String name;
const LocationSearchResultWidget(
this.name, {
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 6.0),
margin: const EdgeInsets.symmetric(vertical: 6.0),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
const Icon(
Icons.location_on,
),
const Padding(padding: EdgeInsets.only(left: 20.0)),
Flexible(
child: Text(
name,
overflow: TextOverflow.clip,
),
),
],
),
],
),
);
}
}

View file

@ -1,27 +0,0 @@
import 'package:flutter/material.dart';
import 'package:photos/ui/viewer/search/location_search_widget.dart';
class SearchPage extends StatefulWidget {
const SearchPage({Key key}) : super(key: key);
@override
State<SearchPage> createState() => _SearchPageState();
}
class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const LocationSearchWidget(),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.search),
onPressed: () {},
)
],
),
body: Container(),
);
}
}

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/ui/viewer/search/collectionSuggestions.dart';
import 'package:photos/ui/viewer/search/collection_suggestions.dart';
class SearchResultsSuggestions extends StatefulWidget {
final List<Collection> collections;

View file

@ -4,7 +4,7 @@ import 'package:flutter/src/widgets/framework.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/ui/viewer/search/SearchResultsSuggestions.dart';
import 'package:photos/ui/viewer/search/search_results_suggestions.dart';
class SearchIconWidget extends StatefulWidget {
bool openSearch;