flutter 装饰盒子,边框,圆角,阴影,形状,渐变,背景

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class mydemo extends StatelessWidget {
  // const mydemo({super.key});
 
  @override
  Widget build(BuildContext context) {
    return Container(
      //color: Colors.red,
      decoration: BoxDecoration(
          image: DecorationImage(
              image: NetworkImage(
                  'https://scpic2.chinaz.net/Files/pic/pic9/202205/apic41182_s.jpg'),
              alignment: Alignment.topCenter,
              repeat: ImageRepeat.repeat,
              fit: BoxFit.cover,
              colorFilter: ColorFilter.mode(
                  Colors.indigoAccent.withOpacity(0.5), BlendMode.hardLight))),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
              child: Icon(Icons.pool, size: 32.0, color: Colors.white),
              //color: Color.fromRGBO(3, 54, 255, 1.0),
              //padding: EdgeInsets.all(16.0),
              margin: EdgeInsets.all(8.0),
              width: 90.0,
              height: 90.0,
              decoration: BoxDecoration(
                  color: Color.fromRGBO(3, 54, 255, 1.0),
                  //borderRadius: BorderRadius.circular(16.0),
                  // borderRadius: BorderRadius.only(
                  //     topLeft: Radius.circular(18.0),
                  //     bottomLeft: Radius.circular(18.0)),
                  border: Border.all(
                    color: Colors.white,
                    width: 1.0,
                  ),
                  boxShadow: [
                    BoxShadow(
                      offset: Offset(5.0, 5.0),
                      color: Colors.blueAccent,
                      blurRadius: 2.0, //模糊程度
                      spreadRadius: 2.0, //扩散,整数变大
                    )
                  ],
                  shape: BoxShape.circle, //不能与borderRadius同时存在
                  gradient:
                      //RadialGradient(colors: [Colors.green, Colors.white]), //镜像渐变
                      LinearGradient(
                          colors: [Colors.green, Colors.white],
                          begin: Alignment.topCenter) //线性渐变
                  ))
        ],
      ),
    );
  }
}

  

posted @   小小强学习网  阅读(127)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
历史上的今天:
2017-08-31 Chrome 最小化恢复之后部分黑屏
点击右上角即可分享
微信分享提示