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,
        ],
      ),
    ),
  );
}

效果如下:

你可能感兴趣的:(flutter,flutter)