Files
xueguang_flutter_app/lib/global/theme/theme.dart
2025-11-28 18:01:09 +08:00

42 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'base/app_colors_base.dart';
import 'base/app_text_style.dart';
import 'base/app_theme_ext.dart';
export 'themes/light_theme.dart';
export 'base/app_theme_ext.dart';
class AppTheme {
static ThemeData createTheme(AppColorsBase themeBase) {
final textTheme = buildTextTheme(themeBase);
return ThemeData(
useMaterial3: true,
fontFamily: "资源圆体",
primaryColor: themeBase.primary,
scaffoldBackgroundColor: themeBase.surfaceContainerHigh,
colorScheme: ColorScheme.fromSeed(
seedColor: themeBase.primary,
brightness: Brightness.light,
onSurfaceVariant: themeBase.textSecondary,
//背景色
surfaceContainerHigh: themeBase.surfaceContainerHigh,
surfaceContainer: themeBase.surfaceContainer,
surfaceContainerLow: themeBase.surfaceContainerLow,
surfaceContainerLowest: themeBase.surfaceContainerLowest,
//阴影
shadow: themeBase.shadow,
),
textTheme: textTheme,
extensions: [AppThemeExtension(baseTheme: themeBase)],
// pageTransitionsTheme: const PageTransitionsTheme(),
appBarTheme: AppBarTheme(
backgroundColor: Colors.white,
titleTextStyle: textTheme.titleMedium,
scrolledUnderElevation: 0,
),
);
}
}