英文:
Can someone please explain why my flutter code doesn't work
问题
以下是您要翻译的代码部分:
Column(
children: <Widget>[
SizedBox(height: 10),
Text(
"No Transactions Yet!!",
style: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 20,
),
Container(
alignment: Alignment(0, 0),
height: 240,
child: Image.asset('assets/images/wait.png', fit: BoxFit.cover),
),
],
)
另外,请注意,您在尝试修复图片显示的问题时提供了以下代码:
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/wait.jpg"),
fit: BoxFit.cover,
),
),
)
如果您还有其他问题或需要更多帮助,请随时提出。
英文:
children: <Widget>[
SizedBox(height: 10),
Text(
"No Transactions Yet!!",
style: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 20,
),
Container(
alignment: Alignment(0, 0),
height: 240,
child: Image.asset('assets/images/wait.png',
fit: BoxFit.cover),
),
],
)
this is a part of my flutter code, I have downloaded a png file and edited that picture so that it can have white background, now my problem is, it is not getting matched with the background of my App's Background (background color is white) . It is like a pasted picture onto the screen . How to fix this.
I am giving the picture try to see that in different directions so that you can understand my problem.
enter image description here
I have tried like this
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/wait.jpg"),
fit: BoxFit.cover,
),
),
here the photo was zoomed in.
答案1
得分: 1
更改背景颜色为Color(0xffffffff)
:
Scaffold(
backgroundColor: Color(0xffffffff),
body:.....
)
英文:
seems now ur background color is Color(0xfffefefe)
change it to Color(0xffffffff)
Scaffold(
backgroundColor: Color(0xffffffff),
body:.....
)
答案2
得分: 1
你需要将你的 Scaffold 背景颜色设置为 Colors.white。
Scaffold(
backgroundColor: Colors.white,
body: Column(
children: <Widget>[
SizedBox(height: 10),
Text(
"No Transactions Yet!!",
style: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 20,
),
Container(
alignment: Alignment(0, 0),
height: 240,
child: Image.asset('assets/images/wait.png', fit: BoxFit.cover),
),
],
),
)
英文:
For this you need to set your Scaffold background color to Colors.white.
Scaffold(
backgroundColor: Colors.white
body: Column(
children: <Widget>[
SizedBox(height: 10),
Text(
"No Transactions Yet!!",
style: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 20,
),
Container(
alignment: Alignment(0, 0),
height: 240,
child: Image.asset('assets/images/wait.png',
fit: BoxFit.cover),
),
],
)
)
答案3
得分: 1
更改脚手架的背景颜色为白色。
英文:
change the background color to white in scaffold
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论