1
-
2
1
import 'package:books_app/constants/routes.dart' ;
3
2
import 'package:books_app/providers/book.dart' ;
4
3
import 'package:books_app/services/auth.dart' ;
@@ -39,7 +38,7 @@ class _BookDescriptionState extends State<BookDescription>
39
38
Padding (
40
39
padding: const EdgeInsets .fromLTRB (15 , 0 , 10 , 10 ),
41
40
child: ReadMoreText (
42
- widget.bookFromList! .description! ,
41
+ widget.bookFromList! .description ?? 'No Description' ,
43
42
style: GoogleFonts .poppins (
44
43
color: Colors .blueGrey,
45
44
fontWeight: FontWeight .w500,
@@ -60,7 +59,7 @@ class _BookDescriptionState extends State<BookDescription>
60
59
Widget build (BuildContext context) {
61
60
final dynamic uid = _authService.getUID;
62
61
final DatabaseService _databaseService =
63
- DatabaseService (uid: uid as String );
62
+ DatabaseService (uid: uid as String );
64
63
print (widget.bookFromList! .rating);
65
64
print (_tabController! .index);
66
65
return SafeArea (
@@ -96,68 +95,68 @@ class _BookDescriptionState extends State<BookDescription>
96
95
return < SliverToBoxAdapter > [
97
96
SliverToBoxAdapter (
98
97
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:
113
112
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),
157
114
),
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
+ ),
159
133
),
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
+ )),
161
160
SliverToBoxAdapter (
162
161
child: TabBar (
163
162
controller: _tabController,
@@ -213,7 +212,7 @@ class _BookDescriptionState extends State<BookDescription>
213
212
child: Column (
214
213
children: < Widget > [
215
214
Button (
216
- // color: blackButton,
215
+ // color: blackButton,
217
216
name: 'Rate this Book' ,
218
217
myFunction: () async {
219
218
final int ? stars = await showDialog (
@@ -226,7 +225,7 @@ class _BookDescriptionState extends State<BookDescription>
226
225
print ('Update Ratings' );
227
226
}),
228
227
Button (
229
- // color: blackButton,
228
+ // color: blackButton,
230
229
name: 'Remove this Book' ,
231
230
myFunction: () async {
232
231
_databaseService
@@ -239,15 +238,15 @@ class _BookDescriptionState extends State<BookDescription>
239
238
)
240
239
else
241
240
Button (
242
- // color: blackButton,
241
+ // color: blackButton,
243
242
name: 'Exchange this Book' ,
244
243
myFunction: () async {}),
245
244
],
246
245
),
247
246
ListView (
248
247
physics: const NeverScrollableScrollPhysics (),
249
248
children: < Widget > [
250
- OwnerInfo (),
249
+ OwnerInfo (userid : widget.bookFromList ! .userid ),
251
250
Padding (
252
251
padding: const EdgeInsets .all (15.0 ),
253
252
child: Column (
@@ -307,4 +306,4 @@ class _BookDescriptionState extends State<BookDescription>
307
306
// ),
308
307
// );
309
308
// }
310
- }
309
+ }
0 commit comments