修改前代码
// GridView.builder(
// physics: new NeverScrollableScrollPhysics(),
// shrinkWrap: true,
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// //横轴元素个数
// crossAxisCount: 5,
// //纵轴间距
// mainAxisSpacing: 7.0,
// //横轴间距
// crossAxisSpacing: 7.0,
// //子组件宽高长度比例
// childAspectRatio: 2.1/1), itemCount:_model!.data![0].attributeLineIds![index].valueIds!.length,
// itemBuilder: (BuildContext context, int a){
// return GestureDetector(
// onTap: (){
// _model!.data![0].attributeLineIds![index].indexSelection = a;
//
// setState(() {
//
// });
// },
// child: Container(
// decoration: BoxDecoration(
// border: Border.all(color:_model!.data![0].attributeLineIds![index].indexSelection==a?Colors.deepOrange:Colors.transparent),
// color: _model!.data![0].attributeLineIds![index].indexSelection==a?Colors.deepOrange.shade100:Colors.grey[200],
// borderRadius: BorderRadius.circular(20.0),
// ),
// padding: EdgeInsets.all(5),
// alignment: Alignment.center,
// child: Text('${_model!.data![0].attributeLineIds![index].valueIds![a].name}',
// style: TextStyle(fontSize: 12,color:_model!.data![0].attributeLineIds![index].indexSelection==a?Colors.deepOrange:Colors.black87),
//
// ),
// ),
// );
// })
使用 Bruno 修改后代码
BrnSelectTag(
initTagState: [
true
],
tags: _model!.data![0].attributeLineIds![index].valueIds!.map((e) => e.name!).toList(),
isSingleSelect: true,
fixWidthMode: false,
spacing: 12,
onSelect: (selectedIndexes) {
// BrnToast.show(selectedIndexes.toString(), context);
_model!.data![0].attributeLineIds![index].indexSelection = selectedIndexes[0];
setState(() {
});
}
),
中亿丰—李宇坤