Where is the problem in my code ?
My app works fine in debug mode. But when I go to release mode, Some widgets don't show which placed in stack.
I took internet permission also. <uses-permission android:name="android.permission.INTERNET"/>
Here is my Debug version output that I want.
And here is my release version output
Here is my code -
import 'package:boimarket/model/model.dart';
import 'package:boimarket/screen/pdfscreen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class BookDescription extends StatefulWidget {
BookDescription({Key key, @required this.storyBooksValue}) : super(key: key);
final storyBooksValue;
@override
_BookDescriptionState createState() => _BookDescriptionState();
}
class _BookDescriptionState extends State<BookDescription> {
@override
void initState() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitDown,
DeviceOrientation.portraitUp,
]);
super.initState();
}
@override
void dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitDown,
DeviceOrientation.portraitUp,
]);
}
@override
Widget build(BuildContext context) {
var _boxHeight = MediaQuery.of(context).size.height;
var _boxWidth = MediaQuery.of(context).size.width;
final Color _whiteCream = Color.fromRGBO(250, 245, 228, .8);
final Color _darkBlue = Color.fromRGBO(0, 68, 69, 1);
final Color _lightBlue = Color.fromRGBO(44, 120, 108, 1);
return Scaffold(
appBar: null,
body: Stack(
children: <Widget>[
Container(
color: _lightBlue,
child: Stack(
children: <Widget>[
Card(
elevation: 10,
child: Container(
height: _boxHeight,
width: _boxWidth,
child: FadeInImage.assetNetwork(
fadeOutCurve: Curves.easeInCubic,
placeholder: 'assets/images/cover.jpg',
image: widget.storyBooksValue.imgUrl == null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: widget.storyBooksValue.imgUrl,
height: _boxHeight,
width: _boxWidth,
fit: BoxFit.cover,
),
),
),
Container(
height: _boxHeight,
width: _boxWidth,
color: Colors.black54,
),
Align(
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Column(
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 20, top: 60.0),
child: Expanded(
child: Text(
"এই লেখকের আরও কিছু বই",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white),
overflow: TextOverflow.clip,
),
),
),
Container(
padding: EdgeInsets.only(top: 10, bottom: 10),
height: 250.0,
child: FutureBuilder(
future: fetchBooks(),
builder: (context,
AsyncSnapshot<List<Book>> snapshot) {
if (!snapshot.hasData) {
return Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(
backgroundColor: _whiteCream,
),
Text("Loading"),
],
);
} else {
var writterBooks = snapshot.data
.where((b) =>
b.author ==
widget.storyBooksValue.author)
.toList();
print(writterBooks.length);
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: writterBooks.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Route route = MaterialPageRoute(
builder: (context) =>
BookDescription(
storyBooksValue:
writterBooks[
index]),
);
Navigator.push(context, route);
},
child: Container(
padding: EdgeInsets.all(10),
child: Column(
children: [
Container(
width: 100,
height: 140.0,
child: ClipRRect(
borderRadius:
BorderRadius
.circular(5.0),
child: FadeInImage
.assetNetwork(
fadeOutCurve:
Curves.linear,
placeholder:
'assets/images/cover.jpg',
image: writterBooks[
index]
.imgUrl ==
null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: writterBooks[
index]
.imgUrl,
width: 90,
height: 120.0,
fit: BoxFit.cover,
),
),
),
Flexible(
child: Container(
width: 90,
child: Text(
"${writterBooks[index].name}",
style: TextStyle(
color:
Colors.white,
fontWeight:
FontWeight
.bold,
fontSize: 12.0),
overflow:
TextOverflow.clip,
),
),
),
],
),
),
);
});
}
},
),
),
],
),
),
Container(
width: _boxWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40.0),
topRight: Radius.circular(40.0)),
color: _whiteCream,
boxShadow: [
BoxShadow(
color: Colors.black45,
blurRadius: 5.0,
spreadRadius: 1.0)
],
),
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
children: <Widget>[
SizedBox(
height: 30.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "বইয়ের নামঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.name}")
]),
),
SizedBox(
height: 5.0,
),
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "লেখকঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.author}")
]),
),
SizedBox(
height: 5.0,
),
RichText(
overflow: TextOverflow.clip,
text: TextSpan(
style: TextStyle(
color: Colors.black),
children: [
TextSpan(
text: "বইয়ের ধরণঃ",
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16.0)),
TextSpan(
text:
" ${widget.storyBooksValue.genreClass}")
]),
),
],
),
),
),
Card(
elevation: 5.0,
child: FadeInImage.assetNetwork(
fadeOutCurve: Curves.easeInCubic,
placeholder: 'assets/images/cover.jpg',
image: widget.storyBooksValue.imgUrl ==
null
? "https://firebasestorage.googleapis.com/v0/b/boi-market.appspot.com/o/images%2Fcover.jpg?alt=media&token=f8070b25-533c-454b-9d2e-80702d72371e"
: widget.storyBooksValue.imgUrl,
height: 100.0,
fit: BoxFit.cover,
),
),
],
),
Divider(),
widget.storyBooksValue.description == null
? Center(
child: Text(
'দুঃখিত, ${widget.storyBooksValue.name} বইটির বর্ণনা পাওয়া যায়নি'))
: SelectableText(
'${widget.storyBooksValue.description} \n',
),
Text(
'আমরা বইটির একটি ebook খুজে পেয়েছি । \n\n আপনি বইটি পড়তে চাইলে, " Read Now " বাটনে ক্লিক করুন । \n'),
SizedBox(
height: 75.0,
)
],
),
),
),
],
),
),
)
],
),
),
Padding(
padding: EdgeInsets.only(left: 10.0, top: 20.0),
child: IconButton(
icon: Icon(Icons.arrow_back),
color: _whiteCream,
onPressed: () {
Navigator.pop(context, false);
}),
),
Positioned(
bottom: 60.0,
right: 20.0,
child: RaisedButton(
onPressed: () {
print("clicked");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PdfScreen(singleBookData: widget.storyBooksValue)),
);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30)),
color: _darkBlue,
child: Text(
"Read now",
style: TextStyle(color: _whiteCream),
),
),
),
],
),
);
}
}
How can I fix this problem? please someone help me.