Reputation: 840
With the deprecated RaisedButton
class, it was easy to create a gradient background for a button using the decoration
property, and using the different Gradient classes with an array of Colors.
However, using the new and improved (?) ElevatedButton
class, I just cant figure out how to accomplish this.
Every bit of online information refers to the deprecated use cases, and digging through the API docs I cant find something equivalent to decoration
.
So, any suggestions?
Upvotes: 1
Views: 253
Reputation: 408
Wrap a Container
with a GestureDetector
The GestureDetector
will give you to onTap
functionality.
The Container
will provide the decoration
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
child: Container(
decoration: BoxDecoration(
// Decorate here
),
child: Center(
// Enter content here
),
),
);
}
Upvotes: 1