diff --git a/lib/src/widget/app.dart b/lib/src/widget/app.dart index 70948b8d..e88ef9a2 100644 --- a/lib/src/widget/app.dart +++ b/lib/src/widget/app.dart @@ -73,27 +73,20 @@ class NeumorphicApp extends StatelessWidget { }) : super(key: key); ThemeData _getMaterialTheme(NeumorphicThemeData theme) { - final color = theme.accentColor; + final brightness = ThemeData.estimateBrightnessForColor(theme.baseColor); - if (color is MaterialColor) { - return ThemeData( - primarySwatch: color, - textTheme: theme.textTheme, - iconTheme: theme.iconTheme, - scaffoldBackgroundColor: theme.baseColor, - ); - } + final colorScheme = ColorScheme.fromSeed( + seedColor: theme.accentColor, + brightness: brightness, + ).copyWith( + secondary: theme.variantColor, + ); return ThemeData( - primaryColor: theme.accentColor, - accentColor: theme.variantColor, - iconTheme: theme.iconTheme, - brightness: ThemeData.estimateBrightnessForColor(theme.baseColor), - primaryColorBrightness: - ThemeData.estimateBrightnessForColor(theme.accentColor), - accentColorBrightness: - ThemeData.estimateBrightnessForColor(theme.variantColor), + useMaterial3: true, + colorScheme: colorScheme, textTheme: theme.textTheme, + iconTheme: theme.iconTheme, scaffoldBackgroundColor: theme.baseColor, ); } diff --git a/lib/src/widget/app_bar.dart b/lib/src/widget/app_bar.dart index 75768744..ea41ddbf 100644 --- a/lib/src/widget/app_bar.dart +++ b/lib/src/widget/app_bar.dart @@ -178,10 +178,10 @@ class NeumorphicAppBarState extends State { Widget? title = widget.title; if (title != null) { - final AppBarTheme appBarTheme = AppBarTheme.of(context); + final AppBarThemeData appBarTheme = AppBarTheme.of(context); title = DefaultTextStyle( - style: (appBarTheme.textTheme?.headline5 ?? - Theme.of(context).textTheme.headline5!) + style: (appBarTheme.titleTextStyle ?? + Theme.of(context).textTheme.titleLarge!) .merge(widget.textStyle ?? nTheme?.current?.appBarTheme.textStyle), softWrap: false, overflow: TextOverflow.ellipsis, diff --git a/lib/src/widget/container.dart b/lib/src/widget/container.dart index 9e1e94fa..248768a0 100644 --- a/lib/src/widget/container.dart +++ b/lib/src/widget/container.dart @@ -118,7 +118,7 @@ class _NeumorphicContainer extends StatelessWidget { final shape = this.style.boxShape ?? NeumorphicBoxShape.rect(); return DefaultTextStyle( - style: this.textStyle ?? material.Theme.of(context).textTheme.bodyText2!, + style: this.textStyle ?? material.Theme.of(context).textTheme.bodyMedium!, child: AnimatedContainer( margin: this.margin, duration: this.duration,