diff --git a/README.md b/README.md index 0ce583c..e36f816 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,7 @@ Please star⭐ the repo if you like what you see😉. |**Provider**| State Management| |**Object DB**| No SQL database to store Favorites & Downloads| |**XML2JSON**| Convert XML to JSON| -|**HTTP**| Network calls| -|**DIO**| Download files| +|**DIO**| Network calls and File Download| ## 🤓 Author(s) diff --git a/assets/images/empty.png b/assets/images/empty.png new file mode 100644 index 0000000..d94f6a2 Binary files /dev/null and b/assets/images/empty.png differ diff --git a/lib/screen/details.dart b/lib/screen/details.dart index 424454a..0b99067 100644 --- a/lib/screen/details.dart +++ b/lib/screen/details.dart @@ -261,7 +261,7 @@ class Details extends StatelessWidget { SizedBox(height: 30,), Text( - "Related Books", + "More from Author", style: TextStyle( color: Theme.of(context).accentColor, fontSize: 20, diff --git a/lib/screen/downloads.dart b/lib/screen/downloads.dart index 6d6723e..dfaf9a8 100644 --- a/lib/screen/downloads.dart +++ b/lib/screen/downloads.dart @@ -36,10 +36,31 @@ class _DownloadsState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text("Downloads"), -// elevation: 4, ), - body: ListView.separated( + body: dls.isEmpty + ? Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + "assets/images/empty.png", + height: 300, + width: 300, + ), + + Text( + "Nothing is here", + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ) + : ListView.separated( padding: EdgeInsets.symmetric(horizontal: 15), shrinkWrap: true, itemCount: dls.length, diff --git a/lib/screen/favorites.dart b/lib/screen/favorites.dart index 7a291dc..6d9376b 100644 --- a/lib/screen/favorites.dart +++ b/lib/screen/favorites.dart @@ -16,7 +16,28 @@ class Favorites extends StatelessWidget { "Favorites", ), ), - body: GridView.builder( + body: favoritesProvider.posts.isEmpty + ? Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + "assets/images/empty.png", + height: 300, + width: 300, + ), + + Text( + "Nothing is here", + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ) + : GridView.builder( padding: EdgeInsets.fromLTRB(10, 20, 10, 0), shrinkWrap: true, itemCount: favoritesProvider.posts.length, diff --git a/lib/util/api.dart b/lib/util/api.dart index 5c43caf..2756dd0 100644 --- a/lib/util/api.dart +++ b/lib/util/api.dart @@ -1,6 +1,6 @@ import 'dart:convert'; +import 'package:dio/dio.dart'; import 'package:flutter_ebook_app/podo/category.dart'; -import 'package:http/http.dart' as http; import 'package:xml2json/xml2json.dart'; class Api { @@ -27,12 +27,14 @@ class Api { static String horror = "https://catalog.feedbooks.com/publicdomain/browse/en/top.atom?cat=FBFIC015000"; - static Future getCategory(String url) async { - var res = await http.get(url); + static Future getCategory(String url) async { + Dio dio = Dio(); + + var res = await dio.get(url); CategoryFeed category; if(res.statusCode == 200){ Xml2Json xml2json = new Xml2Json(); - xml2json.parse(res.body); + xml2json.parse(res.data.toString()); var json = jsonDecode(xml2json.toGData()); category = CategoryFeed.fromJson(json); }else{ diff --git a/pubspec.lock b/pubspec.lock index 7600a98..18b1d37 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -185,7 +185,7 @@ packages: source: hosted version: "0.14.0+3" http: - dependency: "direct main" + dependency: transitive description: name: http url: "https://pub.dartlang.org" diff --git a/pubspec.yaml b/pubspec.yaml index 9f51fad..1c8b09a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,6 @@ dependencies: page_transition: ^1.1.5 flutter_icons: ^1.0.0+1 flutter_html: ^0.11.0 - http: ^0.12.0+3 xml2json: ^4.1.1 fluttertoast: ^3.1.3 esys_flutter_share: ^1.0.2