收藏按钮实现

hmxc
张萌 4 years ago
parent b026ba478a
commit 6d364a6b35

@ -19,6 +19,7 @@ class GoodsDetailsBottomBar extends StatefulWidget {
class _GoodsDetailsBottomBarState extends State<GoodsDetailsBottomBar> { class _GoodsDetailsBottomBarState extends State<GoodsDetailsBottomBar> {
int count = 1; int count = 1;
bool _isCollected = false;
void _showModelBotoomSheet(String type) { void _showModelBotoomSheet(String type) {
showModalBottomSheet( showModalBottomSheet(
// isScrollControlled: true, // isScrollControlled: true,
@ -62,11 +63,17 @@ class _GoodsDetailsBottomBarState extends State<GoodsDetailsBottomBar> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Icon( _isCollected
AntDesign.staro, ? Icon(
color: Color(0xff000000), AntDesign.star,
size: ScreenUtil().setSp(38), color: Colors.red,
), size: 38.sp,
)
: Icon(
AntDesign.staro,
color: Color(0xff000000),
size: ScreenUtil().setSp(38),
),
SizedBox(height: 2), SizedBox(height: 2),
Text( Text(
'收藏', '收藏',
@ -76,7 +83,11 @@ class _GoodsDetailsBottomBarState extends State<GoodsDetailsBottomBar> {
) )
], ],
), ),
onTap: () {}, onTap: () {
setState(() {
_isCollected = !_isCollected;
});
},
), ),
SizedBox(width: ScreenUtil().setWidth(46)), SizedBox(width: ScreenUtil().setWidth(46)),
InkWell( InkWell(

Loading…
Cancel
Save