I don't know how you're doing it, try this code:
Widget build(BuildContext context) {
var primary = Theme.of(context).primaryColor;
var secondary = Colors.white;
var selected = true;
return Scaffold(
body: TweenAnimationBuilder(
tween: ColorTween(begin: secondary, end: selected ? primary : secondary),
duration: Duration(milliseconds: 300),
builder: (BuildContext context, Color color, Widget child) {
return Card(
color: color,
child: InkWell(
splashColor: Colors.blue,
onTap: () => print('Does nothing'),
child: Container(
height: 75,
width: 400,
child: Center(child: Text('Title')),
),
),
);
},
),
);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…