
試圖通過動態添加SizedBox(child:Text('XVI', style:TextStyle(...),),)并在每個事件上ListView重復它來獲得它。但沒有得到它。有沒有其他方法可以實作這一目標?onPressedTextButton
uj5u.com熱心網友回復:
試試這個代碼
Wrap(
spacing: 5,
runSpacing: 5,
children: List.generate(
20, // Here add the list length
(index) {
return Container(
color: index.isEven ? Colors.black : Colors.grey, // Change the background color based on your condition
child: Text("XXIV", style: TextStyle(color: Colors.white)),
);
},
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/522162.html
