Skip to content

Commit

Permalink
Dialog barrier and shadow colors
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-molinski committed Jan 15, 2025
1 parent ad75848 commit 6502b8e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
final Color onErrorVariant;
final Color errorContainer;
final Color onErrorContainer;
final Color overlay;
final Color dropShadow;

const VoicesColorScheme({
required this.textPrimary,
Expand Down Expand Up @@ -125,6 +127,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
required this.onErrorVariant,
required this.errorContainer,
required this.onErrorContainer,
required this.overlay,
required this.dropShadow,
});

@visibleForTesting
Expand Down Expand Up @@ -187,6 +191,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
this.onErrorVariant = Colors.black,
this.errorContainer = Colors.black,
this.onErrorContainer = Colors.black,
this.overlay = Colors.black,
this.dropShadow = Colors.black,
});

@override
Expand Down Expand Up @@ -249,6 +255,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
Color? onErrorVariant,
Color? errorContainer,
Color? onErrorContainer,
Color? overlay,
Color? dropShadow,
}) {
return VoicesColorScheme(
textPrimary: textPrimary ?? this.textPrimary,
Expand Down Expand Up @@ -321,6 +329,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
onErrorVariant: onErrorVariant ?? this.onErrorVariant,
errorContainer: errorContainer ?? this.errorContainer,
onErrorContainer: onErrorContainer ?? this.onErrorContainer,
overlay: overlay ?? this.overlay,
dropShadow: dropShadow ?? this.dropShadow,
);
}

Expand Down Expand Up @@ -467,6 +477,8 @@ class VoicesColorScheme extends ThemeExtension<VoicesColorScheme> {
errorContainer: Color.lerp(errorContainer, other.errorContainer, t)!,
onErrorContainer:
Color.lerp(onErrorContainer, other.onErrorContainer, t)!,
overlay: Color.lerp(overlay, other.overlay, t)!,
dropShadow: Color.lerp(dropShadow, other.dropShadow, t)!,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:catalyst_voices_brands/src/theme_extensions/brand_assets.dart';
import 'package:catalyst_voices_brands/src/theme_extensions/voices_color_scheme.dart';
import 'package:catalyst_voices_brands/src/themes/widgets/buttons_theme.dart';
import 'package:catalyst_voices_brands/src/themes/widgets/toggles_theme.dart';
import 'package:catalyst_voices_brands/src/themes/widgets/voices_dialog_theme.dart';
import 'package:catalyst_voices_brands/src/themes/widgets/voices_input_decoration_theme.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
Expand Down Expand Up @@ -85,6 +86,8 @@ const VoicesColorScheme darkVoicesColorScheme = VoicesColorScheme(
onErrorVariant: VoicesColors.darkOnErrorVariant,
errorContainer: VoicesColors.darkErrorContainer,
onErrorContainer: VoicesColors.darkOnErrorContainer,
overlay: Color(0xA610141C),
dropShadow: Color(0xA610141C),
);

const ColorScheme lightColorScheme = ColorScheme.light(
Expand Down Expand Up @@ -167,6 +170,8 @@ const VoicesColorScheme lightVoicesColorScheme = VoicesColorScheme(
onErrorVariant: VoicesColors.lightOnErrorVariant,
errorContainer: VoicesColors.lightErrorContainer,
onErrorContainer: VoicesColors.lightOnErrorContainer,
overlay: Color(0x9904080F),
dropShadow: Color(0x9904080F),
);

/// [ThemeData] for the `catalyst` brand.
Expand Down Expand Up @@ -315,13 +320,7 @@ ThemeData _buildThemeData(
drawerTheme: DrawerThemeData(
backgroundColor: voicesColorScheme.onSurfaceNeutralOpaqueLv0,
),
dialogTheme: DialogTheme(
// N10-38
barrierColor: const Color(0x212A3D61),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
clipBehavior: Clip.hardEdge,
backgroundColor: voicesColorScheme.elevationsOnSurfaceNeutralLv1White,
),
dialogTheme: VoicesDialogTheme(colors: voicesColorScheme),
listTileTheme: ListTileThemeData(
shape: const StadiumBorder(),
minTileHeight: 56,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:catalyst_voices_brands/catalyst_voices_brands.dart';
import 'package:flutter/material.dart';

class VoicesDialogTheme extends DialogTheme {
VoicesDialogTheme({
required VoicesColorScheme colors,
}) : super(
barrierColor: colors.overlay,
shadowColor: colors.dropShadow,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
clipBehavior: Clip.hardEdge,
backgroundColor: colors.elevationsOnSurfaceNeutralLv1White,
);
}

0 comments on commit 6502b8e

Please sign in to comment.