Skip to content
On this page

Config 全局配置 ​

代码演示 ​

默认主题 ​

默认主题为浅色;内建浅色(light,fallback)、深色(dark) 主题

dart
VanConfig(
  theme: MediaQuery.of(context).platformBrightness == Brightness.dark
      ? VanTheme.dark
      : VanTheme.fallback,
  child: child,
),

定制主题 ​

给出 theme 可以自定义主题颜色

dart
VanConfig(
  theme: VanConfig.ofTheme(context).clone()
    ..primaryColor = const Color(0xFF58BE6A)
    ..dangerColor = const Color(0xFF58BE6A),
  child: child,
),

API ​

Props类型描述
themeVanTheme主题配置