From 3a3e36f4b06af3e93b380656946a8a2c873322b2 Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Sun, 5 Apr 2020 13:12:59 +0530 Subject: [PATCH] Add a search box to UI --- lib/main.dart | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 182763544f..d933a3bd74 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,7 +16,7 @@ final logger = Logger(); void main() async { WidgetsFlutterBinding.ensureInitialized(); - runApp(MyApp2()); + runApp(MyApp()); await provider.refreshGalleryList(); provider.list[0].assetList.then((assets) { @@ -30,7 +30,7 @@ Future init(List assets) async { photoSyncManager.init(); } -class MyApp2 extends StatelessWidget { +class MyApp extends StatelessWidget { final PhotoLoader photoLoader = PhotoLoader.instance; @override @@ -41,8 +41,24 @@ class MyApp2 extends StatelessWidget { builder: (context, snapshot) { Widget body; if (snapshot.hasData) { - body = Gallery(); + body = Container( + child: Column( + children: [ + TextField( + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Search "Paris"', + contentPadding: const EdgeInsets.all(12.0), + ), + ), + Flexible( + child: Gallery(), + ) + ], + ), + ); } else if (snapshot.hasError) { + logger.e(snapshot.error); body = Text("Error!"); } else { body = loadWidget;