I made a website in flutter and then I got a build. But the version in web debug and build does not work the same.
Only the background gif appears on the page. It also appears transparent.
I ran the site in xampp and various hosts for testing purposes and I changed browser but still got the same error.
i rebuild that project.And i used "flutter doctor" , "flutter clean" but didnt work.
It doesn't appear that there is an error in the Web Console.
web debug result :
----
build result
When I built this project for android, it worked fine and gave the same result.
I also built the classic code of fllutter for web and it produced the same result without any problems.
-----------------edit1------------------------------------
i added appbar to my code and i saw it was added in build without any problem. enter image description here
-------------------------edit2----------------------------
then in my code I removed the stack widget attached to the body property of scaffold and I painted all the containers red.And I saw that the rows instead of the whole page are grayed out.(note: the background gif was in the stack, I removed it as well.)
-------------------------edit3----------------------------
I found another similar question in SO.
-------------------------edit3----------------------------
I noticed a important thing.
I found the problem but I don't understand why it happened and how to fix it.
If the expanded and fittedbox widgets in the stack are removed, the problem disappears.
page 1(problematic state) :
return Stack(
children: [
Positioned.fill(
child: Container(
child: Image.asset(
"ImageAssets/mobile.gif",
fit: BoxFit.fill,
),
),
),
Center(
child: Positioned(
top: 0,
left: 0,
child: Container(
width: 1200,
height: 3999,
child: Row(
children: [
Expanded(
flex: 1,
child: SingleChildScrollView(
controller: _scrollController,
child: Container(
width: 600,
height: 1000,
color: Colors.brown.withOpacity(0.2),
child: Column(
children: [
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
],
),
),
),
),
Expanded(
flex: 3,
child: SingleChildScrollView(
child: Container(
height: 3999,
child: Column(
children: [
TextBox(leftMarginValue: widthSize/4,topMarginValue: heightSize/20,insideText: "Testibulum arcu elit, interdum vel porttitor eu.",context: context),
TextBox(leftMarginValue: widthSize/80,topMarginValue: heightSize/20,rightMarginValue: widthSize/4-widthSize/80,insideText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",context: context),
],
),
),
),
),
],
),
),
),
),
],
);
page 2 (problematic state):
child: Stack(
children: [
Container(
height: heightSize / 8,
width: widthSize / 5,
decoration: BoxDecoration(
borderRadius: BorderRadiusDirectional.circular(22),
color: Colors.grey,
border: Border.all(color: Colors.white, width: 2),
),
child: Center(
child: Padding(
padding: EdgeInsetsDirectional.only(
start: widthSize / 80,
end: widthSize / 80,
top: heightSize / 80,
bottom: heightSize / 80),
child: Expanded(
child: FittedBox(
child: Text(
softWrap: false,
overflow: TextOverflow.ellipsis,
insideText,
style: TextStyle(
fontSize: widthSize / 50, color: Colors.white),
),
),
),
),
),
),
],
),
If I build the above codes, the screen is completely gray.
page 2 (expanded and fitted removed from Stack) :
return Stack(
children: [
Container(
child: Image.asset(
"ImageAssets/mobile.gif",
fit: BoxFit.fill,
),
),
Center(
child: Container(
width: 1200,
height: 3999,
child: Row(
children: [
SingleChildScrollView(
controller: _scrollController,
child: Container(
width: 600,
height: 1000,
color: Colors.brown.withOpacity(0.2),
child: Column(
children: [
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
buttonFunc("Home",_scrollController,context),
],
),
),
),
SingleChildScrollView(
child: Container(
height: 3999,
child: Column(
children: [
TextBox(leftMarginValue: widthSize/4,topMarginValue: heightSize/20,insideText: "Testibulum arcu elit, interdum vel porttitor eu.",context: context),
TextBox(leftMarginValue: widthSize/80,topMarginValue: heightSize/20,rightMarginValue: widthSize/4-widthSize/80,insideText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",context: context),
],
),
),
),
],
),
),
),
],
);
page 2 (expanded and fitted removed from Stack):
child: Stack(
children: [
Container(
height: heightSize / 8,
width: widthSize / 5,
decoration: BoxDecoration(
borderRadius: BorderRadiusDirectional.circular(22),
color: Colors.grey,
border: Border.all(color: Colors.white, width: 2),
),
child: Center(
child: Padding(
padding: EdgeInsetsDirectional.only(
start: widthSize / 80,
end: widthSize / 80,
top: heightSize / 80,
bottom: heightSize / 80),
child: Text(
softWrap: false,
overflow: TextOverflow.ellipsis,
insideText,
style: TextStyle(
fontSize: widthSize / 50, color: Colors.white),
),
),
),
),
],
),
If I build the above codes, the gray goes away.
here is the build example of the new codes