import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class LiveRoomGiftItem extends StatefulWidget { final Map item; final int active; final int index; final void Function(int) changeActive; const LiveRoomGiftItem({ super.key, required this.item, required this.active, required this.index, required this.changeActive, }); @override State createState() => _LiveRoomGiftItemState(); } class _LiveRoomGiftItemState extends State { @override Widget build(BuildContext context) { return InkWell( onTap: () { widget.changeActive(widget.index); }, child: Container( width: 83.w, height: 94.w, padding: EdgeInsets.only(top: 10.w), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(9.w)), color: Color.fromRGBO( 117, 98, 249, widget.active == widget.index ? .2 : 0, ), border: Border.all( width: 1, color: Color.fromRGBO( 117, 98, 249, widget.active == widget.index ? 1 : 0, ), ), ), child: Column( children: [ Image.asset(widget.item["icon"], width: 41.w, height: 41.w), SizedBox(height: 7.w), Text( widget.item["title"], style: TextStyle(fontSize: 11.w, color: Colors.white), ), SizedBox(height: 1.w), Text( "${widget.item["price"]}支", style: TextStyle( fontSize: 7.w, color: const Color.fromRGBO(144, 144, 144, 1), ), ), ], ), ), ); } }