我正在Flutter中制作一个应用。我想使用Cupertino计时器选择器,但是当我使用本地化时,计时器选择器在其他语言中不起作用。看来它只能用英语工作。如何用其他语言使用Cupertino计时器选择器?这是我当前的计时器选择器代码。
void _buildTimePicker(BuildContext context) {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
return _buildBottomPicker(
CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.ms,
initialTimerDuration: timer,
onTimerDurationChanged: (Duration newTimer) {
setState(() => timer = newTimer);
},
),
);
},
);}
Widget _buildBottomPicker(Widget picker) {
return Container(
height: 216.0,
padding: const EdgeInsets.only(top: 6.0),
color: CupertinoColors.white,
child: DefaultTextStyle(
style: const TextStyle(
color: CupertinoColors.black,
fontSize: 22.0,
),
child: GestureDetector(
// Blocks taps from propagating to the modal sheet and popping.
onTap: () {},
child: SafeArea(
top: false,
child: picker,
),
),
),
);
}