From f3a9a3e094426ce637d9bf14b42e28ca7e30346d Mon Sep 17 00:00:00 2001 From: cyblogerz Date: Sat, 6 Aug 2022 22:57:47 +0530 Subject: [PATCH] Added progress indicator for search results --- lib/pages/home.dart | 4 +-- .../{explore_page.dart => pdf_landing.dart} | 0 lib/pages/result_list.dart | 17 +++++++++--- lib/pages/settings_page.dart | 27 +++++++++++++------ 4 files changed, 35 insertions(+), 13 deletions(-) rename lib/pages/{explore_page.dart => pdf_landing.dart} (100%) diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 86beab6..9c008eb 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'package:zippy/utils/book_view.dart'; -import 'package:zippy/pages/explore_page.dart'; +import 'package:zippy/pages/pdf_landing.dart'; import 'package:zippy/pages/settings_page.dart'; import 'package:zippy/providers/bookData.dart'; import 'package:zippy/widgets/book_tile.dart'; @@ -85,7 +85,7 @@ class _HomeState extends State { child: Column( children: [ UserAccountsDrawerHeader( - decoration: BoxDecoration(color: Colors.pink), + decoration: BoxDecoration(color: Color(0xff6540FF)), currentAccountPicture: ClipRRect( borderRadius: BorderRadius.circular(10), child: Image.network( diff --git a/lib/pages/explore_page.dart b/lib/pages/pdf_landing.dart similarity index 100% rename from lib/pages/explore_page.dart rename to lib/pages/pdf_landing.dart diff --git a/lib/pages/result_list.dart b/lib/pages/result_list.dart index 9fbf988..9d833ce 100644 --- a/lib/pages/result_list.dart +++ b/lib/pages/result_list.dart @@ -53,11 +53,22 @@ class _ResultListState extends State { return true; }, child: ListView.builder( - itemCount: searchResults.length, - itemBuilder: (ctx, index) => ChangeNotifierProvider.value( + itemCount: searchResults.length + 1, + itemBuilder: (ctx, index) { + if (index < searchResults.length) { + return ChangeNotifierProvider.value( value: searchResults[index], child: BookListTile(searchResults[index]), - )), + ); + } else { + return const Padding( + padding: EdgeInsets.symmetric(vertical: 32), + child: Center( + child: CircularProgressIndicator(), + ), + ); + } + }), )); } } diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index 02d62fa..37cbe99 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -12,14 +12,25 @@ class SettingsPage extends StatelessWidget { child: Container( padding: EdgeInsets.all(20), width: MediaQuery.of(context).size.width * 0.5, - decoration: BoxDecoration(boxShadow: [ - BoxShadow( - color: Color.fromARGB(110, 158, 158, 158), - spreadRadius: 5, - blurRadius: 10, - offset: Offset(0, 5)) - ], borderRadius: BorderRadius.circular(32), color: Colors.white), - child: Text('This is a demo app developed for SECURE dev Task'), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.purple, Colors.deepPurple, Colors.blueAccent], + begin: Alignment.bottomRight, + end: Alignment.topLeft, + ), + boxShadow: [ + BoxShadow( + color: Color.fromARGB(75, 124, 77, 255), + spreadRadius: 5, + blurRadius: 10, + offset: Offset(0, 5)) + ], + borderRadius: BorderRadius.circular(32), + color: Colors.white), + child: Text( + 'This is a demo app developed for SECURE dev Task', + style: TextStyle(color: Colors.white), + ), ), ), );