Skip to content

Commit dd1379a

Browse files
authored
Merge pull request #146 from keyurgit45/hacktober/keyur
Fixes #79 PR #146 Edit Profile and Owner's Info tab fixed
2 parents 70cede2 + e35e870 commit dd1379a

12 files changed

+407
-335
lines changed

lib/main.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:books_app/constants/colors.dart';
33
import 'package:books_app/providers/books.dart';
44
import 'package:books_app/providers/quote.dart';
55
import 'package:books_app/providers/theme.dart';
6+
import 'package:books_app/providers/user.dart';
67
import 'package:books_app/screens/home.dart';
78
import 'package:books_app/screens/initial_screen.dart';
89
import 'package:books_app/services/auth.dart';
@@ -31,7 +32,7 @@ Future<void> main() async {
3132
),
3233
ChangeNotifierProvider<QuoteService>(
3334
create: (_) => QuoteService(),
34-
)
35+
),
3536
],
3637
child: MyApp(),
3738
),
@@ -65,7 +66,7 @@ class Wrapper extends StatelessWidget {
6566
@override
6667
Widget build(BuildContext context) {
6768
final FirebaseAuthService firebaseAuthService =
68-
Provider.of<FirebaseAuthService>(context);
69+
Provider.of<FirebaseAuthService>(context);
6970
return StreamBuilder<User?>(
7071
stream: firebaseAuthService.onAuthStateChanged,
7172
builder: (_, AsyncSnapshot<User?> snapshot) {
@@ -75,9 +76,9 @@ class Wrapper extends StatelessWidget {
7576
} else {
7677
return const Center(
7778
child: CircularProgressIndicator(
78-
color: blackButton,
79-
));
79+
color: blackButton,
80+
));
8081
}
8182
});
8283
}
83-
}
84+
}

lib/providers/user.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class UserData extends ChangeNotifier {
1010
String? phoneNumber;
1111
String? photoURL;
1212
String? city;
13-
String? state;
13+
String? streetAddress;
1414
double? latitude;
1515
double? longitude;
1616
double? locationRange;
@@ -26,7 +26,7 @@ class UserData extends ChangeNotifier {
2626
this.phoneNumber,
2727
this.photoURL,
2828
this.city,
29-
this.state,
29+
this.streetAddress,
3030
this.refreshToken,
3131
this.latitude = 0.0,
3232
this.longitude = 0.0,

lib/screens/add_book.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ class _AddBookState extends State<AddBook> {
3030
DatabaseService(uid: uid as String);
3131
final Books bookList = Provider.of<Books>(context, listen: false);
3232
return Scaffold(
33-
appBar: MyAppBar(context),
33+
appBar: AppBar(
34+
elevation: 0.0,
35+
leading: BackButton(),
36+
),
3437
body: SingleChildScrollView(
3538
child: Column(
39+
mainAxisAlignment: MainAxisAlignment.center,
3640
children: <Widget>[
3741
Padding(
3842
padding: const EdgeInsets.all(18.0),

lib/screens/book_desciption.dart

Lines changed: 66 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'package:books_app/constants/routes.dart';
32
import 'package:books_app/providers/book.dart';
43
import 'package:books_app/services/auth.dart';
@@ -39,7 +38,7 @@ class _BookDescriptionState extends State<BookDescription>
3938
Padding(
4039
padding: const EdgeInsets.fromLTRB(15, 0, 10, 10),
4140
child: ReadMoreText(
42-
widget.bookFromList!.description!,
41+
widget.bookFromList!.description ?? 'No Description',
4342
style: GoogleFonts.poppins(
4443
color: Colors.blueGrey,
4544
fontWeight: FontWeight.w500,
@@ -60,7 +59,7 @@ class _BookDescriptionState extends State<BookDescription>
6059
Widget build(BuildContext context) {
6160
final dynamic uid = _authService.getUID;
6261
final DatabaseService _databaseService =
63-
DatabaseService(uid: uid as String);
62+
DatabaseService(uid: uid as String);
6463
print(widget.bookFromList!.rating);
6564
print(_tabController!.index);
6665
return SafeArea(
@@ -96,68 +95,68 @@ class _BookDescriptionState extends State<BookDescription>
9695
return <SliverToBoxAdapter>[
9796
SliverToBoxAdapter(
9897
child: Center(
99-
child: Column(
100-
children: <Widget>[
101-
Padding(
102-
padding: const EdgeInsets.all(10.0),
103-
child: Container(
104-
height: 192,
105-
width: 140,
106-
decoration: BoxDecoration(
107-
boxShadow: const <BoxShadow>[
108-
BoxShadow(color: Colors.grey, blurRadius: 15)
109-
],
110-
borderRadius: BorderRadius.circular(10),
111-
image: DecorationImage(
112-
image:
98+
child: Column(
99+
children: <Widget>[
100+
Padding(
101+
padding: const EdgeInsets.all(10.0),
102+
child: Container(
103+
height: 192,
104+
width: 140,
105+
decoration: BoxDecoration(
106+
boxShadow: const <BoxShadow>[
107+
BoxShadow(color: Colors.grey, blurRadius: 15)
108+
],
109+
borderRadius: BorderRadius.circular(10),
110+
image: DecorationImage(
111+
image:
113112
NetworkImage(widget.bookFromList!.imageUrl!),
114-
fit: BoxFit.fill),
115-
),
116-
),
117-
),
118-
Text(
119-
widget.bookFromList!.title!,
120-
textAlign: TextAlign.center,
121-
style: GoogleFonts.poppins(
122-
color: Colors.black,
123-
fontSize: 22,
124-
fontWeight: FontWeight.w600,
125-
),
126-
),
127-
Text(
128-
widget.bookFromList!.author!,
129-
style: GoogleFonts.poppins(
130-
color: Colors.black.withOpacity(0.5),
131-
fontWeight: FontWeight.w500,
132-
fontSize: 15,
133-
),
134-
),
135-
Padding(
136-
padding: const EdgeInsets.only(left: 100),
137-
child: IconButton(
138-
alignment: Alignment.topRight,
139-
onPressed: () async {
140-
try {
141-
setState(() {
142-
widget.bookFromList!.changeBookMark();
143-
_databaseService
144-
.updateBookMark(widget.bookFromList!);
145-
});
146-
// _databaseService.updateBookMark(widget.bookFromList);
147-
} catch (e) {
148-
print(e.toString());
149-
}
150-
print('Book Marked');
151-
},
152-
icon: widget.bookFromList!.isBookMarked!
153-
? const Icon(Icons.bookmark)
154-
: const Icon(Icons.bookmark_outline_rounded),
155-
iconSize: 20,
156-
),
113+
fit: BoxFit.fill),
157114
),
158-
],
115+
),
116+
),
117+
Text(
118+
widget.bookFromList!.title!,
119+
textAlign: TextAlign.center,
120+
style: GoogleFonts.poppins(
121+
color: Colors.black,
122+
fontSize: 22,
123+
fontWeight: FontWeight.w600,
124+
),
125+
),
126+
Text(
127+
widget.bookFromList!.author!,
128+
style: GoogleFonts.poppins(
129+
color: Colors.black.withOpacity(0.5),
130+
fontWeight: FontWeight.w500,
131+
fontSize: 15,
132+
),
159133
),
160-
)),
134+
Padding(
135+
padding: const EdgeInsets.only(left: 100),
136+
child: IconButton(
137+
alignment: Alignment.topRight,
138+
onPressed: () async {
139+
try {
140+
setState(() {
141+
widget.bookFromList!.changeBookMark();
142+
_databaseService
143+
.updateBookMark(widget.bookFromList!);
144+
});
145+
// _databaseService.updateBookMark(widget.bookFromList);
146+
} catch (e) {
147+
print(e.toString());
148+
}
149+
print('Book Marked');
150+
},
151+
icon: widget.bookFromList!.isBookMarked!
152+
? const Icon(Icons.bookmark)
153+
: const Icon(Icons.bookmark_outline_rounded),
154+
iconSize: 20,
155+
),
156+
),
157+
],
158+
),
159+
)),
161160
SliverToBoxAdapter(
162161
child: TabBar(
163162
controller: _tabController,
@@ -213,7 +212,7 @@ class _BookDescriptionState extends State<BookDescription>
213212
child: Column(
214213
children: <Widget>[
215214
Button(
216-
// color: blackButton,
215+
// color: blackButton,
217216
name: 'Rate this Book',
218217
myFunction: () async {
219218
final int? stars = await showDialog(
@@ -226,7 +225,7 @@ class _BookDescriptionState extends State<BookDescription>
226225
print('Update Ratings');
227226
}),
228227
Button(
229-
// color: blackButton,
228+
// color: blackButton,
230229
name: 'Remove this Book',
231230
myFunction: () async {
232231
_databaseService
@@ -239,15 +238,15 @@ class _BookDescriptionState extends State<BookDescription>
239238
)
240239
else
241240
Button(
242-
// color: blackButton,
241+
// color: blackButton,
243242
name: 'Exchange this Book',
244243
myFunction: () async {}),
245244
],
246245
),
247246
ListView(
248247
physics: const NeverScrollableScrollPhysics(),
249248
children: <Widget>[
250-
OwnerInfo(),
249+
OwnerInfo(userid: widget.bookFromList!.userid),
251250
Padding(
252251
padding: const EdgeInsets.all(15.0),
253252
child: Column(
@@ -307,4 +306,4 @@ class _BookDescriptionState extends State<BookDescription>
307306
// ),
308307
// );
309308
// }
310-
}
309+
}

0 commit comments

Comments
 (0)