fixed scheme mapping and returned to SchemeTonalSpot

This commit is contained in:
Vadim 2024-05-20 16:40:20 +02:00
parent 1bd26e0ff3
commit d268a4f8ae
5 changed files with 36 additions and 33 deletions

View file

@ -73,7 +73,7 @@ ThemeData themeFrom(Color primaryColor, Brightness brightness) {
} }
ColorScheme _colorSchemeFromColor(Color primaryColor, Brightness brightness) { ColorScheme _colorSchemeFromColor(Color primaryColor, Brightness brightness) {
final scheme = SchemeRainbow( final scheme = SchemeTonalSpot(
sourceColorHct: Hct.fromInt(primaryColor.value), sourceColorHct: Hct.fromInt(primaryColor.value),
isDark: brightness == Brightness.dark, isDark: brightness == Brightness.dark,
contrastLevel: 0.0, contrastLevel: 0.0,
@ -82,10 +82,10 @@ ColorScheme _colorSchemeFromColor(Color primaryColor, Brightness brightness) {
return ColorScheme( return ColorScheme(
brightness: brightness, brightness: brightness,
background: Color(scheme.background), background: Color(scheme.background),
error: Color(scheme.error),
errorContainer: Color(scheme.errorContainer),
onBackground: Color(scheme.onBackground), onBackground: Color(scheme.onBackground),
error: Color(scheme.error),
onError: Color(scheme.onError), onError: Color(scheme.onError),
errorContainer: Color(scheme.errorContainer),
onErrorContainer: Color(scheme.onErrorContainer), onErrorContainer: Color(scheme.onErrorContainer),
primary: Color(scheme.primary), primary: Color(scheme.primary),
onPrimary: Color(scheme.onPrimary), onPrimary: Color(scheme.onPrimary),
@ -93,18 +93,21 @@ ColorScheme _colorSchemeFromColor(Color primaryColor, Brightness brightness) {
onPrimaryContainer: Color(scheme.onPrimaryContainer), onPrimaryContainer: Color(scheme.onPrimaryContainer),
secondary: Color(scheme.secondary), secondary: Color(scheme.secondary),
onSecondary: Color(scheme.onSecondary), onSecondary: Color(scheme.onSecondary),
surface: Color.alphaBlend( secondaryContainer: Color(scheme.secondaryContainer),
Color(scheme.primary).withOpacity(0.05), onSecondaryContainer: Color(scheme.onSecondaryContainer),
Color(scheme.background), tertiary: Color(scheme.tertiary),
), onTertiary: Color(scheme.onTertiary),
tertiaryContainer: Color(scheme.tertiaryContainer),
onTertiaryContainer: Color(scheme.onTertiaryContainer),
surface: Color(scheme.surface),
onSurface: Color(scheme.onSurface), onSurface: Color(scheme.onSurface),
surfaceVariant: Color.alphaBlend( surfaceVariant: Color(scheme.surfaceVariant),
Color(scheme.primary).withOpacity(0.5),
Color(scheme.background),
),
onSurfaceVariant: Color(scheme.onSurfaceVariant), onSurfaceVariant: Color(scheme.onSurfaceVariant),
outline: Color(scheme.outline), outline: Color(scheme.outline),
outlineVariant: Color(scheme.outlineVariant), outlineVariant: Color(scheme.outlineVariant),
surfaceTint: Color(scheme.surfaceTint),
shadow: Color(scheme.shadow),
scrim: Color(scheme.scrim),
); );
} }

View file

@ -47,31 +47,31 @@ class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClo
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ClipRRect( return DecoratedBox(
borderRadius: BorderRadius.circular(Dimens.borderRadiusM), decoration: BoxDecoration(
child: ColoredBox( borderRadius: BorderRadius.circular(Dimens.borderRadiusM),
color: backgroundColor(context), color: backgroundColor(context),
child: Padding( ),
padding: const EdgeInsets.all(Dimens.paddingM), child: Padding(
child: Stack( padding: const EdgeInsets.all(Dimens.paddingM),
children: [ child: Stack(
if (locked) children: [
Positioned( if (locked)
top: 0, Positioned(
right: 0, top: 0,
child: Icon( right: 0,
Icons.lock_outlined, child: Icon(
size: Theme.of(context).textTheme.labelMedium!.fontSize, Icons.lock_outlined,
color: Theme.of(context).colorScheme.onPrimaryContainer, size: Theme.of(context).textTheme.labelMedium!.fontSize,
), color: Theme.of(context).colorScheme.onPrimaryContainer,
), ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: _items,
), ),
], Column(
), crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: _items,
),
],
), ),
), ),
); );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 KiB

After

Width:  |  Height:  |  Size: 498 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 KiB

After

Width:  |  Height:  |  Size: 858 KiB