英文:
showdatepicker flutter text color showing white unselect year white how solve it
问题
showDatePicker(
context: context,
// 当前状态的上下文
initialDate: DateTime.now(),
firstDate: DateTime(2000),
// 不允许选择今天之前的日期:DateTime.now()
lastDate: DateTime.now(),
)
颜色变更 showDatePicker(
context: context,
// 当前状态的上下文
initialDate: DateTime.now(),
firstDate: DateTime(2000),
// 不允许选择今天之前的日期:DateTime.now()
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData(
primarySwatch: Colors.grey,
splashColor: Colors.black,
textTheme: const TextTheme(
subtitle1: TextStyle(color: Colors.black),
button: TextStyle(color: Colors.black),
),
hintColor: Colors.black,
colorScheme: const ColorScheme.light(
primary: Colors.blue,
primaryVariant: Colors.black,
secondaryVariant: Colors.black,
onSecondary: Colors.black,
onPrimary: Colors.white,
surface: Colors.black,
onSurface: Colors.black,
secondary: Colors.black,
),
dialogBackgroundColor: Colors.white,
),
child: child ?? Text(""),
);
}
)
英文:
showDatePicker(
context: context,
//context of current state
initialDate: DateTime.now(),
firstDate: DateTime(2000),
//DateTime.now() - not to allow to choose before today.
lastDate: DateTime.now(),
)
color changing showDatePicker(
context: context,
//context of current state
initialDate: DateTime.now(),
firstDate: DateTime(2000),
//DateTime.now() - not to allow to choose before today.
lastDate: DateTime.now(),
builder: (BuildContext context, Widget ?child) {
return Theme(
data: ThemeData(
primarySwatch: Colors.grey,
splashColor: Colors.black,
textTheme: const TextTheme(
subtitle1: TextStyle(color: Colors.black),
button: TextStyle(color: Colors.black),
),
hintColor: Colors.black,
colorScheme: const ColorScheme.light(
primary: Colors.blue,
primaryVariant: Colors.black,
secondaryVariant: Colors.black,
onSecondary: Colors.black,
onPrimary: Colors.white,
surface: Colors.black,
onSurface: Colors.black,
secondary: Colors.black),
dialogBackgroundColor: Colors.white,
),
child: child ??Text(""),
);
}
)
答案1
得分: -1
showDatePicker(
context: context,
// 当前上下文
initialDate: DateTime.now(),
firstDate: DateTime(2000),
// 不允许选择今天之前的日期 DateTime.now()
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData(
primarySwatch: Colors.grey,
splashColor: Colors.black,
textTheme: const TextTheme(
subtitle1: TextStyle(color: Colors.black),
button: TextStyle(color: Colors.black),
),
hintColor: Colors.black,
colorScheme: const ColorScheme.light(
primary: Colors.blue,
primaryVariant: Colors.black,
secondaryVariant: Colors.black,
onSecondary: Colors.black,
onPrimary: Colors.white,
surface: Colors.black,
onSurface: Colors.black,
secondary: Colors.black,
),
dialogBackgroundColor: Colors.white,
),
child: child ?? Text(""),
);
}
)
英文:
showDatePicker(
context: context,
//context of current state
initialDate: DateTime.now(),
firstDate: DateTime(2000),
//DateTime.now() - not to allow to choose before today.
lastDate: DateTime.now(),
builder: (BuildContext context, Widget ?child) {
return Theme(
data: ThemeData(
primarySwatch: Colors.grey,
splashColor: Colors.black,
textTheme: const TextTheme(
subtitle1: TextStyle(color: Colors.black),
button: TextStyle(color: Colors.black),
),
hintColor: Colors.black,
colorScheme: const ColorScheme.light(
primary: Colors.blue,
primaryVariant: Colors.black,
secondaryVariant: Colors.black,
onSecondary: Colors.black,
onPrimary: Colors.white,
surface: Colors.black,
onSurface: Colors.black,
secondary: Colors.black),
dialogBackgroundColor: Colors.white,
),
child: child ??Text(""),
);
}
)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论