isDarkModel method

bool isDarkModel(
  1. BuildContext context
)

系统当前是否是暗黑模式

Implementation

bool isDarkModel(BuildContext context) {
  Brightness brightness = MediaQuery.of(context).platformBrightness;
  return brightness == Brightness.dark;
}