我使用以下代码:
Widget getSelectSortBy() {
return InkWell(
onHover: (value) {
setState(() {
_isHoveringSortBy = value;
});
},
// onTap needs to be implemented
// otherwise onHover does NOT work! */don't know why/*
onTap: () => {},
child: AnimatedContainer(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16)),
color: blueSortBy,
border: Border.all(
color: _isHoveringSortBy
? Colors.white
: Colors.transparent,
width: 1.0)),
duration: timeHoveringBottomAnimatedContainer,
padding: EdgeInsets.only(top: 8, bottom: 9, left: 20, right: 28),
child: Row(
// rest of the code of Row
)
);
}
Run Code Online (Sandbox Code Playgroud)
我发现我需要实现小部件onTap() …