Flutter背景渐变效果

代码如下:

Widget main(){
  return Container(
    height: 100.0,
    width: double.infinity,
    child: new Text("data"),
    decoration: BoxDecoration(
      gradient: LinearGradient(
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
        colors: [
          Colors.amberAccent,
          Colors.white,
        ],
      ),
    ),
  );
}

效果如下:

猜你喜欢

转载自blog.csdn.net/wxx314165038/article/details/120765422
今日推荐