Flutter设置Widget阴影

boxShadow

 decoration: BoxDecoration(
            boxShadow: [
              BoxShadow(
                blurRadius: 4,
                spreadRadius: 2,
                color: Color.fromARGB(20, 0, 0, 0),
              ),
            ],
          ),

渐变颜色按钮

decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(45.0)),
                    gradient: LinearGradient(
                        begin: Alignment.topLeft,
                        end: Alignment.bottomRight,
                        colors: [Color(0xFF36A4F2), Color(0xFF2A5CF6)]),
                  ),

Flutter textfeild失去焦点

new Scaffold(
body: new GestureDetector(
  onTap: () {
    FocusScope.of(context).requestFocus(new FocusNode());
  },
child: new Container(
   //rest of your code write here
    )
)

Flutter如何取消水波纹效果

MaterialApp 下 使用 theme :ThemeData. 

highlightColor是设置点击后的颜色 默认是透明白色

splashColor是水波纹的颜色 

很多人使用inkwell去掉水波纹。

其实把highlightColor和splashColor跟背景色设置成一个就不再有水波纹效果啦

                InkWell(
                  highlightColor: Colors.transparent,
                  splashColor:Colors.transparent,       
                  child: Icon(Icons.clear),
                  onTap: () {},
                )

 

你可能感兴趣的:(Flutter)