diff --git a/lib/ui/face_search_results_page.dart b/lib/ui/face_search_results_page.dart index 1ce5f3640c33c607a905593694c2b62c063c4603..67c07f738bbf915969ffd775a0d4b22757325dc7 100644 --- a/lib/ui/face_search_results_page.dart +++ b/lib/ui/face_search_results_page.dart @@ -4,6 +4,7 @@ import 'package:photos/face_search_manager.dart'; import 'package:photos/models/face.dart'; import 'package:photos/models/photo.dart'; import 'package:photos/ui/circular_network_image_widget.dart'; +import 'package:photos/ui/loading_widget.dart'; import 'package:photos/ui/thumbnail_widget.dart'; import 'package:photos/ui/detail_page.dart'; @@ -50,7 +51,7 @@ class FaceSearchResultsPage extends StatelessWidget { crossAxisCount: 4, )); } else { - return Text("Loading..."); + return Center(child: loadWidget); } }, ); diff --git a/lib/ui/home_widget.dart b/lib/ui/home_widget.dart index 11411ccd325bbfd4b271d8ab50df1fd1d4bfb81a..74cd4bc81d3a7a62184ad2bbc0af22efa83c4b28 100644 --- a/lib/ui/home_widget.dart +++ b/lib/ui/home_widget.dart @@ -14,6 +14,7 @@ import 'package:photos/ui/gallery.dart'; import 'package:photos/ui/gallery_app_bar_widget.dart'; import 'package:photos/ui/loading_widget.dart'; import 'package:photos/ui/remote_folder_gallery_widget.dart'; +import 'package:photos/ui/search_page.dart'; import 'package:photos/utils/logging_util.dart'; import 'package:shake/shake.dart'; import 'package:logging/logging.dart'; @@ -89,6 +90,21 @@ class _HomeWidgetState extends State { } }, ), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) { + return SearchPage(); + }, + ), + ); + }, + child: Icon(Icons.search), + elevation: 1, + backgroundColor: Colors.white30, + foregroundColor: Colors.amber, + ), ); } diff --git a/lib/ui/search_page.dart b/lib/ui/search_page.dart index ec36847a0dfbf646a87781dc45d6f0f7967ea408..26d51ab0df72e2141e2633dcb221600313fa673b 100644 --- a/lib/ui/search_page.dart +++ b/lib/ui/search_page.dart @@ -4,6 +4,7 @@ import 'package:photos/face_search_manager.dart'; import 'package:photos/models/face.dart'; import 'package:photos/ui/circular_network_image_widget.dart'; import 'package:photos/ui/face_search_results_page.dart'; +import 'package:photos/ui/loading_widget.dart'; class SearchPage extends StatelessWidget { final FaceSearchManager _faceSearchManager = FaceSearchManager.instance; @@ -11,21 +12,12 @@ class SearchPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Hero( - tag: "search", - flightShuttleBuilder: (BuildContext flightContext, - Animation animation, - HeroFlightDirection flightDirection, - BuildContext fromHeroContext, - BuildContext toHeroContext) => - Material(child: toHeroContext.widget), - child: TextField( - autofocus: true, - decoration: InputDecoration( - border: InputBorder.none, - hintText: 'Search your photos', - contentPadding: const EdgeInsets.all(0.0), - ), + title: TextField( + autofocus: true, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Search your photos', + contentPadding: const EdgeInsets.all(0.0), ), ), actions: [ @@ -57,8 +49,10 @@ class SearchPage extends StatelessWidget { return _buildItem(context, snapshot.data[index]); }), ); + } else if (snapshot.hasError) { + return Center(child: Text("Error: " + snapshot.error.toString())); } else { - return Text("Loading..."); + return Center(child: loadWidget); } }, );