gpt4 book ai didi

flutter - 如何制作好的 flutter 阴影效果?

转载 作者:行者123 更新时间:2023-12-03 03:08:44 24 4
gpt4 key购买 nike

我想做出如下图好的阴影效果,

enter image description here enter image description here

网上找的例子都比不上上面的设计。

经过长时间的尝试和错误,我可以做出以下。仍然无法制作内影。如果有人能指导我如何破译这个设计,那就太好了。

enter image description here

用于制作上述按钮的代码,

Widget buildBackButton() {
double size = 47;
return Stack(
children: <Widget>[
Container(
width: size,
height: size,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.black26,
offset: Offset(20, 20),
blurRadius: 40,
),
BoxShadow(
color: Colors.white,
offset: Offset(-20, -20),
blurRadius: 25,
)
]),
child: Material(
color: Color(0xffe0eafb),
borderRadius: BorderRadius.circular(size),
elevation: 10,
child: Padding(
padding: const EdgeInsets.all(3.0),
child: ClipOval(
clipper: MClipper(),
),
),
),
),
Container(
width: 45.0,
height: 45.0,
padding: EdgeInsets.only(left: 2, top: 2),
child: new RawMaterialButton(
shape: new CircleBorder(),
fillColor: Color(0xffe0eafb),
elevation: 10.0,
child: Icon(
Icons.arrow_back,
color: Colors.black,
),
onPressed: () {},
)),
],
);
}

class MClipper extends CustomClipper<Rect> {
@override
Rect getClip(Size size) {
return Rect.fromCircle(
center: Offset(size.width / 2, size.height / 2),
radius: min(size.width, size.height) / 2);
}

@override
bool shouldReclip(CustomClipper<Rect> oldClipper) {
return true;
}
}

提前致谢。

最佳答案

Blue Raised Button

代码如下:

  Widget build(BuildContext context) {
return Material(
elevation: 2,
type: MaterialType.button,
color: Colors.transparent,
borderRadius: BorderRadius.circular(1000),
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Color(0xff6C96F9), width: 2.0),
borderRadius: BorderRadius.circular(1000),
gradient: RadialGradient(
center: Alignment(0.55, 0.55),
focalRadius: 64,
colors: [
Color(0xff789DF9),
Color(0xff477FF8),
],
),
),
child: GestureDetector(
onTap: () {},
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Icon(
Icons.pause,
color: Colors.white,
),
),
),
),
);
}

关于flutter - 如何制作好的 flutter 阴影效果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60386349/

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