Skip to content

Commit 72cb02c

Browse files
committed
Fix some of the issues. DO NOT MERGE - Tests still failing
1 parent 4e6f8e6 commit 72cb02c

22 files changed

+21
-67
lines changed

packages/zeta_flutter/lib/src/components/buttons/button.dart

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,6 @@ class ZetaButton extends ZetaStatelessWidget {
4040
this.child,
4141
}) : type = ZetaButtonType.primary;
4242

43-
/// Constructs [ZetaButton] with Secondary theme.
44-
@Deprecated('Secondary buttons are deprecated and will be removed in a future version.')
45-
const ZetaButton.secondary({
46-
super.key,
47-
required this.label,
48-
this.onPressed,
49-
this.size = ZetaWidgetSize.medium,
50-
this.borderType,
51-
this.leadingIcon,
52-
this.trailingIcon,
53-
this.focusNode,
54-
this.semanticLabel,
55-
this.child,
56-
}) : type = ZetaButtonType.secondary;
57-
5843
/// Constructs [ZetaButton] with Positive theme.
5944
const ZetaButton.positive({
6045
super.key,

packages/zeta_flutter/lib/src/components/buttons/button_style.dart

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Ignored whilst secondary is still in use
2-
// ignore_for_file: deprecated_member_use_from_same_package
3-
41
import 'package:flutter/material.dart';
52

63
import '../../../zeta_flutter.dart';
@@ -11,12 +8,6 @@ enum ZetaButtonType {
118
/// Border: None.
129
primary,
1310

14-
/// Background: Secondary color; defaults to yellow.
15-
/// Border: None.
16-
17-
@Deprecated('Secondary buttons are deprecated and will be removed in a future version.')
18-
secondary,
19-
2011
/// Background: Positive color; defaults to green.
2112
/// Border: None.
2213
positive,
@@ -46,9 +37,7 @@ enum ZetaButtonType {
4637
Color _backgroundColor(ZetaColors colors) {
4738
switch (this) {
4839
case ZetaButtonType.primary:
49-
return colors.statePrimaryEnabled;
50-
case ZetaButtonType.secondary:
51-
return colors.stateSecondaryEnabled;
40+
return colors.statePrimaryLegacyEnabled;
5241
case ZetaButtonType.positive:
5342
return colors.statePositiveEnabled;
5443
case ZetaButtonType.negative:
@@ -66,9 +55,7 @@ enum ZetaButtonType {
6655
Color _hoverColor(ZetaColors colors) {
6756
switch (this) {
6857
case ZetaButtonType.primary:
69-
return colors.statePrimaryHover;
70-
case ZetaButtonType.secondary:
71-
return colors.stateSecondaryHover;
58+
return colors.statePrimaryLegacyHover;
7259
case ZetaButtonType.positive:
7360
return colors.statePositiveHover;
7461
case ZetaButtonType.negative:
@@ -85,9 +72,7 @@ enum ZetaButtonType {
8572
Color _pressedColor(ZetaColors colors) {
8673
switch (this) {
8774
case ZetaButtonType.primary:
88-
return colors.statePrimarySelected;
89-
case ZetaButtonType.secondary:
90-
return colors.stateSecondarySelected;
75+
return colors.statePrimaryLegacySelected;
9176
case ZetaButtonType.positive:
9277
return colors.statePositiveSelected;
9378
case ZetaButtonType.negative:
@@ -142,11 +127,10 @@ ButtonStyle buttonStyle(
142127
switch (type) {
143128
case ZetaButtonType.outline:
144129
case ZetaButtonType.text:
145-
return colors.mainPrimary;
130+
return colors.mainPrimaryLegacy;
146131
case ZetaButtonType.outlineSubtle:
147132
return colors.mainDefault;
148133
case ZetaButtonType.primary:
149-
case ZetaButtonType.secondary:
150134
case ZetaButtonType.positive:
151135
case ZetaButtonType.negative:
152136
return colors.stateDefaultEnabled;
@@ -164,11 +148,11 @@ ButtonStyle buttonStyle(
164148
}
165149
// TODO(UX-1134): This removes a defualt border when focused, rather than adding a second border when focused.
166150
if (states.contains(WidgetState.focused)) {
167-
return BorderSide(color: colors.borderPrimary, width: ZetaBorders.medium);
151+
return BorderSide(color: colors.borderPrimaryLegacy, width: ZetaBorders.medium);
168152
}
169153
if (type._border) {
170154
return BorderSide(
171-
color: type == ZetaButtonType.outline ? colors.borderPrimaryMain : colors.borderSubtle,
155+
color: type == ZetaButtonType.outline ? colors.borderPrimaryLegacy : colors.borderSubtle,
172156
);
173157
}
174158

@@ -184,11 +168,10 @@ ButtonStyle buttonStyle(
184168
switch (type) {
185169
case ZetaButtonType.outline:
186170
case ZetaButtonType.text:
187-
return colors.mainPrimary;
171+
return colors.mainPrimaryLegacy;
188172
case ZetaButtonType.outlineSubtle:
189173
return colors.mainDefault;
190174
case ZetaButtonType.primary:
191-
case ZetaButtonType.secondary:
192175
case ZetaButtonType.positive:
193176
case ZetaButtonType.negative:
194177
return colors.stateDefaultEnabled;

packages/zeta_flutter/lib/src/components/buttons/icon_button.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ class ZetaIconButton extends ZetaStatelessWidget {
3434
this.semanticLabel,
3535
}) : type = ZetaButtonType.primary;
3636

37-
/// Constructs [ZetaIconButton] with Secondary theme.
38-
@Deprecated('Secondary buttons are deprecated and will be removed in a future version.')
39-
const ZetaIconButton.secondary({
40-
super.key,
41-
super.rounded,
42-
required this.icon,
43-
this.onPressed,
44-
this.size = ZetaWidgetSize.medium,
45-
this.borderType,
46-
this.semanticLabel,
47-
}) : type = ZetaButtonType.secondary;
48-
4937
/// Constructs [ZetaIconButton] with Positive theme.
5038
const ZetaIconButton.positive({
5139
super.key,

packages/zeta_flutter/lib/src/components/checkbox/checkbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class _CheckboxState extends State<ZetaInternalCheckbox> {
241241
BoxShadow(
242242
spreadRadius: 2,
243243
blurStyle: BlurStyle.solid,
244-
color: theme.colors.borderPrimary,
244+
color: theme.colors.borderPrimaryLegacy,
245245
),
246246
],
247247
color: _getBackground(theme),

packages/zeta_flutter/lib/src/components/chips/chip.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class _ZetaChipState extends State<ZetaChip> {
243243
if (states.contains(WidgetState.hovered)) {
244244
return colors.borderHover;
245245
}
246-
return colors.surfaceDefaultInverse;
246+
return colors.stateInverseEnabled;
247247
}
248248
if (states.contains(WidgetState.pressed) || isDragging) {
249249
return colors.surfaceSelected;

packages/zeta_flutter/lib/src/components/fabs/fab.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class _ZetaFABState extends State<ZetaFAB> {
211211
(Set<WidgetState> states) {
212212
if (states.contains(WidgetState.focused)) {
213213
// TODO(UX-1134): This removes a defualt border when focused, rather than adding a second border when focused.
214-
return BorderSide(color: Zeta.of(context).colors.borderPrimary, width: ZetaBorders.medium);
214+
return BorderSide(color: Zeta.of(context).colors.borderPrimaryLegacy, width: ZetaBorders.medium);
215215
}
216216
return null;
217217
},

packages/zeta_flutter/lib/src/components/range_selector/range_selector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class _ZetaRangeSelectorState extends State<ZetaRangeSelector> {
112112
if (widget.onChange == null) {
113113
return colors.mainDisabled;
114114
}
115-
return _selected ? colors.mainPrimary : colors.surfaceDefaultInverse;
115+
return _selected ? colors.mainPrimary : colors.mainDefault;
116116
}
117117

118118
void _onSubmit(TextEditingController controller, {bool lower = true}) {

packages/zeta_flutter/lib/src/components/snack_bar/snack_bar.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class ZetaSnackBar extends SnackBar {
131131
ZetaSnackBarType.warning => colors.surfaceWarningSubtle,
132132
ZetaSnackBarType.deletion || ZetaSnackBarType.error => colors.surfaceNegativeSubtle,
133133
ZetaSnackBarType.view => colors.surfacePrimarySubtle,
134-
_ => colors.surfaceDefaultInverse,
134+
_ => colors.surfaceInversePure,
135135
};
136136
}
137137
}
@@ -225,12 +225,12 @@ class _Action extends StatelessWidget {
225225
return switch (type) {
226226
ZetaSnackBarType.defaultType => _IconButton(
227227
onPressed: () => ScaffoldMessenger.of(context).removeCurrentSnackBar(),
228-
color: colors.surfaceDefaultInverse,
228+
color: colors.iconInverse,
229229
),
230230
ZetaSnackBarType.action => _ActionButton(
231231
onPressed: onPressed,
232232
label: label,
233-
color: colors.borderPrimaryMain,
233+
color: colors.mainLight,
234234
),
235235
ZetaSnackBarType.positive ||
236236
ZetaSnackBarType.info ||
@@ -253,7 +253,7 @@ class _Action extends StatelessWidget {
253253
_ => _ActionButton(
254254
onPressed: onPressed,
255255
label: label,
256-
color: colors.borderPrimaryMain,
256+
color: colors.mainDefault,
257257
),
258258
};
259259
}(),

packages/zeta_flutter/test/src/components/button/button_test.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@ void main() {
1515
});
1616

1717
group('Accessibility Tests', () {
18-
// Ignoring the secondary button type as it is deprecated.
19-
// ignore: deprecated_member_use_from_same_package
20-
final buttonTypes = ZetaButtonType.values.where((type) => type != ZetaButtonType.secondary);
21-
for (final buttonType in buttonTypes) {
18+
for (final buttonType in ZetaButtonType.values) {
2219
for (final size in ZetaWidgetSize.values) {
2320
meetsAccessibilityGuidelinesTest(
2421
ZetaButton(
2522
onPressed: () {},
26-
label: '${buttonType.name} ${size.name}',
23+
label: '$buttonType ${size.name}',
2724
type: buttonType,
2825
size: size,
2926
),
27+
testName: '$buttonType ${size.name}',
3028
);
3129
}
3230
}
2 Bytes
Loading

0 commit comments

Comments
 (0)