gpt4 book ai didi

flutter : Applying One Gradient For Full Background

转载 作者:IT王子 更新时间:2023-10-29 07:20:45 27 4
gpt4 key购买 nike

我如何应用像 here 这样的渐变?应用程序背景?您能看到渐变在应用栏和脚手架主体上向下移动,就像它们是一个小部件而不是 2 个各有自己颜色的小部件一样吗?

最佳答案

您需要使用容器作为脚手架的背景来添加渐变。您可以使用 Opacity小部件以及使容器或任何小部件透明。但这是您正在寻找的确切解决方案:

Scaffold(
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF282a57), Colors.black],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(20, 50, 20, 0),
child: Container(
child: Row(
children: <Widget>[
Icon(Icons.menu,color: Colors.white,),
Spacer(),
Text("Expense",style: TextStyle(color: Colors.white,fontSize: 18,)),
Spacer(),
Icon(Icons.clear, color: Colors.white,)
],
),
),
),
],
),
)

关于 flutter : Applying One Gradient For Full Background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55769009/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com