XTheme function

ThemeData XTheme()

Implementation

ThemeData XTheme() {
  //主要颜色
  Color? primary = Colors.purple;

  return ThemeData(
    //视作主题标志
    hoverColor: const Color(0x0a000001),
    //亮度模式
    brightness: Brightness.light,
    //颜色集合
    colorScheme: ColorScheme.light(
      primary: primary,
      background: Colors.white,
      error: Colors.red,
    ),
    textTheme: const TextTheme(
      titleLarge: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
      titleMedium: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
      titleSmall: TextStyle(fontSize: 13, fontWeight: FontWeight.bold),
      bodyLarge: TextStyle(fontSize: 16),
      bodyMedium: TextStyle(fontSize: 15),
      bodySmall: TextStyle(fontSize: 13),
    ),
    //导航栏主题
    appBarTheme: const AppBarTheme(
      //状态栏主题
      systemOverlayStyle: SystemUiOverlayStyle.light,
      iconTheme: IconThemeData(),
      //标题样式
      titleTextStyle: TextStyle(color: Colors.red),
      color: Colors.white,
      elevation: 0,
    ),
    inputDecorationTheme: const InputDecorationTheme(),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        //按钮背景颜色
        backgroundColor: primary,
        //中心组件的颜色
        foregroundColor: Colors.white,
        //文字样式
        textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
        //按钮阴影
        elevation: 1,
      ),
    ),
    progressIndicatorTheme: const ProgressIndicatorThemeData(
      color: Colors.grey,
    ),
    //弹窗对话颜色
    dialogTheme: const DialogTheme(
      backgroundColor: Colors.white,
    ),
    //分割线主题
    dividerTheme: const DividerThemeData(color: Colors.grey),
  );
}