showdatepicker flutter text color showing white unselect year white how solve it

huangapple go评论95阅读模式
英文:

showdatepicker flutter text color showing white unselect year white how solve it

问题

  1. showDatePicker(
  2. context: context,
  3. // 当前状态的上下文
  4. initialDate: DateTime.now(),
  5. firstDate: DateTime(2000),
  6. // 不允许选择今天之前的日期:DateTime.now()
  7. lastDate: DateTime.now(),
  8. )
  9. 颜色变更 showDatePicker(
  10. context: context,
  11. // 当前状态的上下文
  12. initialDate: DateTime.now(),
  13. firstDate: DateTime(2000),
  14. // 不允许选择今天之前的日期:DateTime.now()
  15. lastDate: DateTime.now(),
  16. builder: (BuildContext context, Widget? child) {
  17. return Theme(
  18. data: ThemeData(
  19. primarySwatch: Colors.grey,
  20. splashColor: Colors.black,
  21. textTheme: const TextTheme(
  22. subtitle1: TextStyle(color: Colors.black),
  23. button: TextStyle(color: Colors.black),
  24. ),
  25. hintColor: Colors.black,
  26. colorScheme: const ColorScheme.light(
  27. primary: Colors.blue,
  28. primaryVariant: Colors.black,
  29. secondaryVariant: Colors.black,
  30. onSecondary: Colors.black,
  31. onPrimary: Colors.white,
  32. surface: Colors.black,
  33. onSurface: Colors.black,
  34. secondary: Colors.black,
  35. ),
  36. dialogBackgroundColor: Colors.white,
  37. ),
  38. child: child ?? Text(""),
  39. );
  40. }
  41. )
英文:

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(),

  1. )

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(),

  1. builder: (BuildContext context, Widget ?child) {
  2. return Theme(
  3. data: ThemeData(
  4. primarySwatch: Colors.grey,
  5. splashColor: Colors.black,
  6. textTheme: const TextTheme(
  7. subtitle1: TextStyle(color: Colors.black),
  8. button: TextStyle(color: Colors.black),
  9. ),
  10. hintColor: Colors.black,
  11. colorScheme: const ColorScheme.light(
  12. primary: Colors.blue,
  13. primaryVariant: Colors.black,
  14. secondaryVariant: Colors.black,
  15. onSecondary: Colors.black,
  16. onPrimary: Colors.white,
  17. surface: Colors.black,
  18. onSurface: Colors.black,
  19. secondary: Colors.black),
  20. dialogBackgroundColor: Colors.white,
  21. ),
  22. child: child ??Text(""),
  23. );
  24. }
  25. )

答案1

得分: -1

  1. showDatePicker(
  2. context: context,
  3. // 当前上下文
  4. initialDate: DateTime.now(),
  5. firstDate: DateTime(2000),
  6. // 不允许选择今天之前的日期 DateTime.now()
  7. lastDate: DateTime.now(),
  8. builder: (BuildContext context, Widget? child) {
  9. return Theme(
  10. data: ThemeData(
  11. primarySwatch: Colors.grey,
  12. splashColor: Colors.black,
  13. textTheme: const TextTheme(
  14. subtitle1: TextStyle(color: Colors.black),
  15. button: TextStyle(color: Colors.black),
  16. ),
  17. hintColor: Colors.black,
  18. colorScheme: const ColorScheme.light(
  19. primary: Colors.blue,
  20. primaryVariant: Colors.black,
  21. secondaryVariant: Colors.black,
  22. onSecondary: Colors.black,
  23. onPrimary: Colors.white,
  24. surface: Colors.black,
  25. onSurface: Colors.black,
  26. secondary: Colors.black,
  27. ),
  28. dialogBackgroundColor: Colors.white,
  29. ),
  30. child: child ?? Text(""),
  31. );
  32. }
  33. )
英文:
  1. showDatePicker(
  2. context: context,
  3. //context of current state
  4. initialDate: DateTime.now(),
  5. firstDate: DateTime(2000),
  6. //DateTime.now() - not to allow to choose before today.
  7. lastDate: DateTime.now(),
  8. builder: (BuildContext context, Widget ?child) {
  9. return Theme(
  10. data: ThemeData(
  11. primarySwatch: Colors.grey,
  12. splashColor: Colors.black,
  13. textTheme: const TextTheme(
  14. subtitle1: TextStyle(color: Colors.black),
  15. button: TextStyle(color: Colors.black),
  16. ),
  17. hintColor: Colors.black,
  18. colorScheme: const ColorScheme.light(
  19. primary: Colors.blue,
  20. primaryVariant: Colors.black,
  21. secondaryVariant: Colors.black,
  22. onSecondary: Colors.black,
  23. onPrimary: Colors.white,
  24. surface: Colors.black,
  25. onSurface: Colors.black,
  26. secondary: Colors.black),
  27. dialogBackgroundColor: Colors.white,
  28. ),
  29. child: child ??Text(""),
  30. );
  31. }
  32. )

huangapple
  • 本文由 发表于 2023年6月13日 19:01:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76464223.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定