Skip to content

Commit

Permalink
feat(cat-voices): new overlay and dropshadow colors (#1526)
Browse files Browse the repository at this point in the history
* chore: make VoicesColorScheme properties not nullable

* Dialog barrier and shadow colors

---------

Co-authored-by: Oleksandr Prokhorenko <[email protected]>
  • Loading branch information
damian-molinski and minikin authored Jan 16, 2025
1 parent 56454b6 commit 45f8b63
Show file tree
Hide file tree
Showing 37 changed files with 278 additions and 239 deletions.
16 changes: 8 additions & 8 deletions catalyst_voices/apps/voices/lib/common/ext/space_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ extension SpaceExt on Space {

Color backgroundColor(BuildContext context) => switch (this) {
Space.discovery =>
Theme.of(context).colors.iconsSecondary!.withOpacity(0.16),
Theme.of(context).colors.iconsSecondary.withOpacity(0.16),
Space.workspace => Theme.of(context).colorScheme.primaryContainer,
Space.voting => Theme.of(context).colors.warningContainer!,
Space.voting => Theme.of(context).colors.warningContainer,
Space.fundedProjects =>
Theme.of(context).colors.iconsSecondary!.withOpacity(0.16),
Space.treasury => Theme.of(context).colors.successContainer!,
Theme.of(context).colors.iconsSecondary.withOpacity(0.16),
Space.treasury => Theme.of(context).colors.successContainer,
};

Color foregroundColor(BuildContext context) => switch (this) {
Space.discovery => Theme.of(context).colors.iconsSecondary!,
Space.discovery => Theme.of(context).colors.iconsSecondary,
Space.workspace => Theme.of(context).colorScheme.primary,
Space.voting => Theme.of(context).colors.iconsWarning!,
Space.fundedProjects => Theme.of(context).colors.iconsSecondary!,
Space.treasury => Theme.of(context).colors.iconsSuccess!,
Space.voting => Theme.of(context).colors.iconsWarning,
Space.fundedProjects => Theme.of(context).colors.iconsSecondary,
Space.treasury => Theme.of(context).colors.iconsSuccess,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class _KeychainCard extends StatelessWidget {
Radius.circular(16),
),
border: Border.all(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
width: 1,
),
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv1White,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class CampaignAdminToolsDialog extends StatelessWidget {
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv1White,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Theme.of(context).colors.onSurfaceNeutral012!,
color: Theme.of(context).colors.onSurfaceNeutral012,
width: 1,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _CampaignStatusIndicator extends StatelessWidget {
decoration: BoxDecoration(
color: currentStatus == campaignStatus
? theme.colors.success
: theme.colors.onSurfaceNeutral012?.withOpacity(.12),
: theme.colors.onSurfaceNeutral012.withOpacity(.12),
borderRadius: BorderRadius.circular(8),
),
child: Padding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class _Segment extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
color: theme.colors.elevationsOnSurfaceNeutralLv1White,
border: Border.all(color: theme.colors.outlineBorderVariant!),
border: Border.all(color: theme.colors.outlineBorderVariant),
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.all(16),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ final class _BackgroundColor implements WidgetStateProperty<Color?> {
@override
Color? resolve(Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) {
return colors.onSurfacePrimaryContainer?.withOpacity(0.12);
return colors.onSurfacePrimaryContainer.withOpacity(0.12);
}

return Colors.transparent;
Expand All @@ -181,7 +181,7 @@ final class _ForegroundColor implements WidgetStateProperty<Color?> {
@override
Color? resolve(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return colors.textOnPrimaryLevel0?.withOpacity(0.3);
return colors.textOnPrimaryLevel0.withOpacity(0.3);
}

return colors.textOnPrimaryLevel0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class UploadSeedPhraseConfirmationDialog extends StatelessWidget {
color: Theme.of(context).colors.iconsError,
),
border: Border.all(
color: Theme.of(context).colors.iconsError!,
color: Theme.of(context).colors.iconsError,
width: 3,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class _InfoContainer extends StatelessWidget {
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv1White,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
),
child: child,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class _Summary extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1.5,
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
),
child: Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _WarningIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final color = theme.colors.iconsError!;
final color = theme.colors.iconsError;

return VoicesAvatar(
border: Border.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WalletSummary extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1.5,
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
),
child: Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ class VoicesIconButton extends StatelessWidget {
side: WidgetStateProperty.resolveWith(
(states) {
if (states.contains(WidgetState.disabled)) {
return BorderSide(color: colors.onSurfaceNeutral012!);
return BorderSide(color: colors.onSurfaceNeutral012);
}

return BorderSide(color: colors.outlineBorderVariant!);
return BorderSide(color: colors.outlineBorderVariant);
},
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CampaignStageCard extends StatelessWidget {
decoration: BoxDecoration(
color: theme.colors.elevationsOnSurfaceNeutralLv1White,
border: Border.all(
color: theme.colors.outlineBorderVariant!,
color: theme.colors.outlineBorderVariant,
),
borderRadius: BorderRadius.circular(20),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class _FundsAndComments extends StatelessWidget {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: Theme.of(context).colors.success?.withOpacity(0.08),
color: Theme.of(context).colors.success.withOpacity(0.08),
borderRadius: BorderRadius.circular(8),
),
child: Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RoleChooserCard extends StatelessWidget {
? null
: BoxDecoration(
border: Border.all(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
width: 1,
),
borderRadius: BorderRadius.circular(8),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class VoicesChip extends StatelessWidget {
border: backgroundColor != null
? null
: Border.all(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
borderRadius: borderRadius,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RolesSummaryContainer extends StatelessWidget {
return DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
width: 1.5,
),
borderRadius: BorderRadius.circular(8),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class WorkspaceTextTileContainer extends StatelessWidget {
),
boxShadow: [
BoxShadow(
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv0!,
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv0,
offset: const Offset(0, 1),
blurRadius: 4,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SingleSelectDropdown<T> extends StatelessWidget {

OutlineInputBorder _border(BuildContext context) => OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ enum VoicesIndicatorType {

Color _iconColor(BuildContext context) {
return switch (this) {
VoicesIndicatorType.normal => Theme.of(context).colors.iconsForeground!,
VoicesIndicatorType.error => Theme.of(context).colors.iconsError!,
VoicesIndicatorType.success => Theme.of(context).colors.iconsSuccess!,
VoicesIndicatorType.normal => Theme.of(context).colors.iconsForeground,
VoicesIndicatorType.error => Theme.of(context).colors.iconsError,
VoicesIndicatorType.success => Theme.of(context).colors.iconsSuccess,
};
}
}
Expand All @@ -38,7 +38,7 @@ class VoicesIndicator extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 16),
decoration: BoxDecoration(
border: Border.all(
color: theme.colors.outlineBorderVariant!,
color: theme.colors.outlineBorderVariant,
width: 1,
),
borderRadius: BorderRadius.circular(8),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _VoicesDesktopDialog extends StatelessWidget {
? RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: Theme.of(context).colors.outlineBorderVariant!,
color: Theme.of(context).colors.outlineBorderVariant,
),
)
: Theme.of(context).dialogTheme.shape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class _InfoContainer extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(context).colors.iconsPrimary!,
color: Theme.of(context).colors.iconsPrimary,
),
),
child: Row(
Expand Down Expand Up @@ -243,7 +243,7 @@ class _UploadContainerState extends State<_UploadContainer> {
borderType: BorderType.RRect,
radius: const Radius.circular(12),
dashPattern: const [8, 6],
color: Theme.of(context).colors.iconsPrimary!,
color: Theme.of(context).colors.iconsPrimary,
child: Stack(
children: [
// We allow drag&drop only on web
Expand Down Expand Up @@ -303,7 +303,7 @@ class _UploadContainerState extends State<_UploadContainer> {
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Theme.of(context).colors.iconsPrimary!,
color: Theme.of(context).colors.iconsPrimary,
width: 3,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _TimeText extends StatelessWidget {
child: ColoredBox(
color: !isSelected
? Colors.transparent
: Theme.of(context).colors.onSurfaceNeutral08!,
: Theme.of(context).colors.onSurfaceNeutral08,
child: Padding(
key: key,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class _SeedPhraseFieldState extends State<SeedPhraseField> {
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: theme.colors.outlineBorder!,
color: theme.colors.outlineBorder,
width: 1.5,
),
borderRadius: BorderRadius.circular(12),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class VoicesDateTimeTextField extends StatelessWidget {

final borderSide = !dimBorder
? BorderSide(
color: theme.colors.outlineBorderVariant!,
color: theme.colors.outlineBorderVariant,
width: 0.75,
)
: BorderSide(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ class _VoicesTextFieldState extends State<VoicesTextField> {
case VoicesTextFieldStatus.none:
return orDefault;
case VoicesTextFieldStatus.success:
return Theme.of(context).colors.success!;
return Theme.of(context).colors.success;
case VoicesTextFieldStatus.warning:
return Theme.of(context).colors.warning!;
return Theme.of(context).colors.warning;
case VoicesTextFieldStatus.error:
return Theme.of(context).colorScheme.error;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SelectableTile extends StatelessWidget {
borderRadius: _borderRadius(isSelected),
boxShadow: [
BoxShadow(
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv0!,
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv0,
offset: const Offset(0, 1),
blurRadius: 4,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class VoicesCheckbox extends StatelessWidget {
side: isDisabled
? BorderSide(
width: 2,
color: Theme.of(context).colors.onSurfaceNeutral012!,
color: Theme.of(context).colors.onSurfaceNeutral012,
)
: null,
),
Expand Down
Loading

0 comments on commit 45f8b63

Please sign in to comment.