问问题
369 次
1 回答
0
问题出在卡上(使用容器)。
尝试这个
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: MyWidget(),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
var monthsOfTheYear = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
var radius = Radius.circular(10);
return ListWheelScrollView(
itemExtent: 60.0,
children: monthsOfTheYear.map(
(month) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(color: Colors.grey, width: 0.1),
left: BorderSide(color: Colors.grey, width: 0.1),
right: BorderSide(color: Colors.grey, width: 0.1),
top: BorderSide(color: Colors.grey, width: 0.1)
),
borderRadius: BorderRadius.only(bottomRight: radius, bottomLeft: radius, topRight: radius),
boxShadow: [
BoxShadow(
color: Colors.grey[200],
spreadRadius: 0,
blurRadius: 0
)
]
),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(0.0),
child: Text(
month,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18.0),
),
),
),
],
),
);
},
).toList(),
);
}
}
输出:
于 2020-04-24T12:04:31.200 回答