Skip to content

Commit 24ba798

Browse files
authored
Merge pull request #140 from kshitij5/hacktober/kshitij5
Fixes #94 : Display nearby books in Explore Nearby Screen Implemented And removed play store navigations
2 parents 36b2b51 + d33f321 commit 24ba798

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+548
-381
lines changed
1 Byte
Binary file not shown.
17 Bytes
Binary file not shown.

.gradle/6.8/gc.properties

Whitespace-only changes.

.gradle/checksums/checksums.lock

17 Bytes
Binary file not shown.

.gradle/configuration-cache/gc.properties

Whitespace-only changes.

.gradle/vcs-1/gc.properties

Whitespace-only changes.

android/app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ dependencies {
6969
implementation platform('com.google.firebase:firebase-bom:26.3.0')
7070
implementation 'com.google.firebase:firebase-analytics'
7171
implementation "androidx.browser:browser:1.3.0"
72-
implementation 'androidx.multidex:multidex:2.0.1'
72+
// implementation 'androidx.multidex:multidex:2.0.1'
73+
74+
// if you are using AndroidX its better to use above dependence for multiDex
75+
implementation 'com.android.support:multidex:1.0.3'
7376
implementation 'com.google.firebase:firebase-auth'
7477
implementation 'com.google.android.gms:play-services-auth:19.0.0'
7578
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

lib/common/themes.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ ThemeData bookTheme() {
102102
inputDecorationTheme: const InputDecorationTheme(
103103
focusedBorder: OutlineInputBorder(
104104
borderSide:
105-
BorderSide(color: Color.fromRGBO(24, 25, 38, 1), width: 2.0),
105+
BorderSide(color: Color.fromRGBO(24, 25, 38, 1), width: 2.0),
106106
borderRadius: BorderRadius.all(Radius.circular(20))),
107107
enabledBorder: OutlineInputBorder(
108108
borderSide:
109-
BorderSide(color: Color.fromRGBO(24, 25, 38, 1), width: 2.0),
109+
BorderSide(color: Color.fromRGBO(24, 25, 38, 1), width: 2.0),
110110
borderRadius: BorderRadius.all(Radius.circular(20)))),
111111
);
112-
}
112+
}

lib/config/api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
/// Save any API Endpoint here
32
const String baseHost = 'https://www.googleapis.com/books/v1/volumes';

lib/main.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class MyApp extends StatelessWidget {
5555
debugShowCheckedModeBanner: false,
5656
title: 'Explr',
5757
home: Wrapper(),
58-
onGenerateRoute: RouteGenerator.generateRoute,
58+
onGenerateRoute: RouteGenerator().generateRoute,
5959
),
6060
);
6161
}
@@ -65,7 +65,7 @@ class Wrapper extends StatelessWidget {
6565
@override
6666
Widget build(BuildContext context) {
6767
final FirebaseAuthService firebaseAuthService =
68-
Provider.of<FirebaseAuthService>(context);
68+
Provider.of<FirebaseAuthService>(context);
6969
return StreamBuilder<User?>(
7070
stream: firebaseAuthService.onAuthStateChanged,
7171
builder: (_, AsyncSnapshot<User?> snapshot) {
@@ -75,9 +75,9 @@ class Wrapper extends StatelessWidget {
7575
} else {
7676
return const Center(
7777
child: CircularProgressIndicator(
78-
color: blackButton,
79-
));
78+
color: blackButton,
79+
));
8080
}
8181
});
8282
}
83-
}
83+
}

lib/providers/book.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class Book with ChangeNotifier {
2020
Book({
2121
// this.id,
2222
this.isbn,
23-
this.title,
23+
this.title='',
2424
this.author,
25-
this.imageUrl,
25+
this.imageUrl = '',
2626
this.userid,
2727
this.description,
2828
this.genre,

lib/providers/books.dart

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import 'package:http/http.dart' as http;
77
import 'book.dart';
88

99
class Books with ChangeNotifier {
10+
11+
// Explore Books
12+
final List<Book> _within3km = <Book>[];
13+
final List<Book> _within5km = <Book>[];
14+
final List<Book> _within10km = <Book>[];
15+
final List<Book> _within20km = <Book>[];
16+
final List<Book> _morethan20km = <Book>[];
17+
1018
//Owned Books
1119
final List<Book> _ownedBooks = <Book>[];
1220

@@ -37,7 +45,26 @@ class Books with ChangeNotifier {
3745
return <Book>[..._discoverNew];
3846
}
3947

40-
//********EXPLORE NEARBY TO BE IMPLEMENTED*******///
48+
//********EXPLORE NEARBY TO BE IMPLEMENTED*******///
49+
List<Book> get within3km {
50+
return _within3km;
51+
}
52+
53+
List<Book> get within5km {
54+
return _within5km;
55+
}
56+
57+
List<Book> get within10km {
58+
return _within10km;
59+
}
60+
61+
List<Book> get within20km {
62+
return _within20km;
63+
}
64+
65+
List<Book> get morethan20km {
66+
return _morethan20km;
67+
}
4168

4269
List<Book> get lentBooks {
4370
return _lentBooks;
@@ -82,7 +109,7 @@ class Books with ChangeNotifier {
82109
};
83110
try {
84111
final http.Response response =
85-
await http.get(Uri.parse(url + isbn.trim()));
112+
await http.get(Uri.parse(url + isbn.trim()));
86113
final dynamic result = jsonDecode(response.body);
87114
// print("Result From get Books From ISBN:");
88115
// print(result["items"][0]);
@@ -100,7 +127,7 @@ class Books with ChangeNotifier {
100127
final dynamic resultJson = jsonDecode(response.body);
101128
if (resultJson != null) {
102129
final String isbn = resultJson['items'][0]['volumeInfo']
103-
['industryIdentifiers'][1]['identifier']
130+
['industryIdentifiers'][1]['identifier']
104131
.toString();
105132
return isbn;
106133
}
@@ -118,7 +145,7 @@ class Books with ChangeNotifier {
118145
final String author = result['volumeInfo']['authors'][0].toString();
119146
final String description = result['volumeInfo']['description'].toString();
120147
final String isbn = result['volumeInfo']['industryIdentifiers'][0]
121-
['identifier']
148+
['identifier']
122149
.toString();
123150
final String infoLink = result['volumeInfo']['infoLink'].toString();
124151

@@ -128,7 +155,7 @@ class Books with ChangeNotifier {
128155
imageLink = imageLink.replaceFirst('http', 'https', 0);
129156
} catch (e) {
130157
imageLink =
131-
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/1200px-No-Image-Placeholder.svg.png';
158+
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/1200px-No-Image-Placeholder.svg.png';
132159
}
133160
print(imageLink.length);
134161
if (imageLink.isEmpty) {
@@ -152,21 +179,21 @@ class Books with ChangeNotifier {
152179
// print(result);
153180
Book book;
154181
final String? description =
155-
result['items'][0]['volumeInfo']['description'] as String?;
182+
result['items'][0]['volumeInfo']['description'] as String?;
156183
final String isbn = isbnCode;
157184
final String? infoLink =
158-
result['items'][0]['volumeInfo']['infoLink'] as String?;
185+
result['items'][0]['volumeInfo']['infoLink'] as String?;
159186
final int? pages = result['items'][0]['volumeInfo']['pageCount'] as int?;
160187
String? imageLink, title, author;
161188
try {
162189
title = result['items'][0]['volumeInfo']['title'] as String?;
163190
author = result['items'][0]['volumeInfo']['authors'][0] as String?;
164191
imageLink = result['items'][0]['volumeInfo']['imageLinks']['thumbnail']
165-
as String?;
192+
as String?;
166193
imageLink = imageLink!.replaceFirst('http', 'https', 0);
167194
} catch (e) {
168195
imageLink =
169-
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/1200px-No-Image-Placeholder.svg.png';
196+
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/1200px-No-Image-Placeholder.svg.png';
170197
author = inputAuthor;
171198
print('imageLink is empty');
172199
}
@@ -212,4 +239,4 @@ class Books with ChangeNotifier {
212239
print(e.toString());
213240
}
214241
}
215-
}
242+
}

lib/screens/auth/forgot_password.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
4646
.ResetPassword(_emailController.text);
4747
setState(() {
4848
_message =
49-
'Password reset link has been sent to you on email ${_emailController.text}.You will be redirected to signIn page';
49+
'Password reset link has been sent to you on email ${_emailController.text}.You will be redirected to signIn page';
5050
});
5151

5252
print(_message);
@@ -99,4 +99,4 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
9999
else
100100
return Container();
101101
}
102-
}
102+
}

lib/screens/auth/login.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@ class _LoginScreenState extends State<LoginScreen> {
2626
padding: const EdgeInsets.all(10.0),
2727
child: SingleChildScrollView(
2828
child: Column(
29-
crossAxisAlignment: CrossAxisAlignment.stretch,
30-
children: <Widget>[
31-
const AuthPageTitle(name: 'Log in'),
32-
// AuthErrorMessage(errorMessage: error.toString()),
33-
Form(
34-
key: formKey,
35-
child: Column(
36-
children: <AuthField>[
37-
EmailTextField(_emailController),
38-
PasswordTextField(_passwordController)
39-
],
40-
),
41-
),
42-
Button(
43-
name: 'Sign in',
44-
color: blackButton,
45-
myFunction: () {
46-
Navigator.pushNamed(context, Routes.HOME);
47-
},
48-
),
49-
buildForgotPasswordButton(),
50-
buildRegisterButton(),
51-
],
52-
)),
29+
crossAxisAlignment: CrossAxisAlignment.stretch,
30+
children: <Widget>[
31+
const AuthPageTitle(name: 'Log in'),
32+
// AuthErrorMessage(errorMessage: error.toString()),
33+
Form(
34+
key: formKey,
35+
child: Column(
36+
children: <AuthField>[
37+
EmailTextField(_emailController),
38+
PasswordTextField(_passwordController)
39+
],
40+
),
41+
),
42+
Button(
43+
name: 'Sign in',
44+
color: blackButton,
45+
myFunction: () {
46+
Navigator.pushNamed(context, Routes.HOME);
47+
},
48+
),
49+
buildForgotPasswordButton(),
50+
buildRegisterButton(),
51+
],
52+
)),
5353
),
5454
);
5555
}
@@ -103,4 +103,4 @@ class _LoginScreenState extends State<LoginScreen> {
103103
),
104104
);
105105
}
106-
}
106+
}

0 commit comments

Comments
 (0)