答案 0 :(得分:0)
@override
Widget build(BuildContext context) {
final double statusbarHeight = MediaQuery.of(context).padding.top;
List<String> litems = [
"Dashboard"
];
List<String> litems_icon = [
"assets/images/sign_out.svg",
];
...
Scaffold(
body: Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: litems.length,
itemBuilder: (BuildContext context, int index) {
Card(
elevation: 8.0,
margin: EdgeInsets.symmetric(horizontal: 1.0, vertical: 1.0),
child: Container(
decoration: BoxDecoration(color: Colors.white),
child: ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 0.0),
leading: Container(
padding: EdgeInsets.only(right: 12.0),
child: SvgPicture.asset(
litems_icon[index],
width: 40.0,
color: const Color(0xFFE27023),
),
),
title: Text(
litems[index],
style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
),
)
),
);
},
),
),
)
答案 1 :(得分:0)
我用ListWheelScrollView解决了这个问题,这就是答案:
ListWheelScrollView(
controller: fixedExtentScrollControllerEvoucher,
physics: FixedExtentScrollPhysics(),
children: opratorsAmount.map((data) {
return Container(width: double.infinity,height: 30,
decoration: BoxDecoration(color: Colors.grey,border: Border.all(color:Colors.black,width: 0.5), borderRadius: new BorderRadius.all(Radius.circular(10))),
child: Center(child: Text(data,style:TextStyle(color: Colors.white,fontSize: 14),textAlign: TextAlign.center)),
margin: EdgeInsets.only(left:5,right:5,top:1,bottom: 1)
);
}).toList(),
itemExtent: 45,
onSelectedItemChanged: (int value){
setState(() {
selectedItem = value;
});
},
useMagnifier: true,magnification: 1.2,
)
opratorsAmount
是一个字符串列表