Image my code can you help me rewrite code by listview.builder in flutter with data
i got problem with listview.builder and row, and listview.builder inside listview.builder. i want rewrite this code with data to show list attributes and option.
and my data "attributes": [ { "id": 2, "name": "Choose 1", "options": [ "Option 1", "Option 2" ] }, { "id": 1, "name": "Choose 2", "options": [ "Option 3", "Option 4" ] } ]
void _showBottomSheetAtribute(context, ProductModel product){
showModalBottomSheet(
context: context,
builder: (context){
return Container(
height: 300,
child: ListView(
padding: EdgeInsets.zero,
children: [
Container(
margin: EdgeInsets.only(
left: 24, top: 24),
child: Text(
"Product Customize",
),
),
Container(
margin: EdgeInsets.only(
left: 24, right: 24),
child: Divider()
),
Container(
margin: EdgeInsets.only(
left: 24, top: 16),
child: Text(
"Type",
),
),
Container(
margin: EdgeInsets.only(top: 16),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
onTap: () {
},
child: Container(
padding: EdgeInsets.only(
left: 12,
right: 12,
top: 8,
bottom: 8),
decoration: BoxDecoration(
color: false
? AppColors.primaryColor
: Colors.transparent,
borderRadius: BorderRadius.all(Radius.circular(4)),
border:
Border.all(color: AppColors.primaryColor, width: 1),
),
child: Text(
"Option",
),
),
),
InkWell(
onTap: () {
},
child: Container(
padding: EdgeInsets.only(
left: 12,
right: 12,
top: 8,
bottom: 8),
decoration: BoxDecoration(
color: true
? AppColors.primaryColor
: Colors.transparent,
borderRadius: BorderRadius.all(Radius.circular(4)),
border:
Border.all(color: AppColors.primaryColor, width: 1),
),
child: Text(
"Bột",
style: TextStyle(
color: AppColors.greyColor,
letterSpacing: 0,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
)
),
Container(
margin: EdgeInsets.only(top: 20, bottom: 10, left: 20, right: 20),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: AppColors.primaryColor,
minimumSize: Size(200, 50),
),
onPressed: () {
_showBottomSheetGoCart(context);
},
child:
const Text(
'Chọn Mua',
style: TextStyle(
fontSize: 14.0,
fontFamily: 'SF Pro Display',
fontWeight: FontWeight.bold
),
),
),
),
],
),
);
}
);
}