How to add two color in TextButton
? We can add LinearGradient
in Container, but how about TextButton?
TextButton.icon(
style: TextButton.styleFrom(
backgroundColor: Colors.blue,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(15.0), // Set the rounded corners
), // Set the background color here
),
onPressed: () {},
label: ListTile(
title: Text("Smart Lock"),
subtitle: Text("For you to lock and unlock door"),
)),
You can try wrap the button with container and make containers color what you want with lineargradient and make the button color Colors.transparent.
Example Code
Container(
decoration: BoxDecoration(
**gradient: LinearGradient(
colors: [Colors.blue, Colors.purple],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),**
),
child: TextButton.icon(
style: TextButton.styleFrom(
**backgroundColor: Colors.transparent,**
),
onPressed: () {},