flutter container decoration background color only top gradient stops code example
Example 1: color gradient in flutter
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green, Colors.blue])
),
Example 2: add gradient bg to container in flutter
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green, Colors.blue])
),
child: Center(
child: Text('Gradients are cool!',
style: TextStyle(
fontSize: 35,
color: Colors.white,
),
),
),
),