如何在Flutter中自定义TimePicker小部件

问题描述

enter image description here

如何从输入时间选择器小部件中更改Purple选择颜色,Purple边框颜色,时间文本颜色以及HourMinute颜色,似乎无法在{{ 1}}

解决方法

showTimePicker(
                  context: context,initialTime: TimeOfDay(hour: 10,minute: 47),builder: (context,child) {
                    return Theme(
                      data: ThemeData.light().copyWith(
                        colorScheme: ColorScheme.light(
                          // change the border color
                          primary: Colors.red,// change the text color
                          onSurface: Colors.purple,),// button colors 
                        buttonTheme: ButtonThemeData(
                          colorScheme: ColorScheme.light(
                            primary: Colors.green,child: child,);
                  },);

结果:

enter image description here