Skip to content

Commit 2382be4

Browse files
committed
feat(navigation-button): fix icon size and customization label in demo app
1 parent f27623b commit 2382be4

6 files changed

Lines changed: 11 additions & 24 deletions

File tree

app/lib/ui/components/button/button_customization_utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Software description: Flutter library of reusable graphical components
1111
//
1212

13-
import 'package:flutter/cupertino.dart';
13+
import 'package:flutter/material.dart';
1414
import 'package:ouds_core/components/button/ouds_button.dart';
1515
import 'package:ouds_flutter_demo/l10n/app_localizations.dart';
1616
import 'package:ouds_flutter_demo/ui/components/button/button_customization.dart';
@@ -120,7 +120,7 @@ class ButtonCustomizationUtils {
120120
BuildContext context,
121121
ButtonCustomizationState? customizationState,
122122
) {
123-
if (customizationState!.navigationTextValue.isEmpty) {
123+
if (customizationState!.textValue.isEmpty) {
124124
if (customizationState.selectedChevron ==
125125
NavigationButtonLayoutEnum.next) {
126126
return context

app/lib/ui/components/button/navigation_button_code_generator.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class NavigationButtonCodeGenerator {
5252
customizationState.selectedNavigationAppearance,
5353
);
5454

55-
final String? label = customizationState.navigationTextValue.isNotEmpty
56-
? customizationState.navigationTextValue
55+
final String? label = customizationState.textValue.isNotEmpty
56+
? customizationState.textValue
5757
: null;
5858

5959
final String layoutStr = layout.toString();

app/lib/ui/components/button/navigation_button_demo_screen.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ class _NavigationButtonDemoState extends State<_NavigationButtonDemo> {
145145
return ComponentDemoBox(
146146
colored: customizationState?.hasOnColoredBox == true,
147147
child: OudsNavigationButton(
148-
label: customizationState!.navigationTextValue.isNotEmpty
149-
? customizationState!.navigationTextValue
148+
label: customizationState!.textValue.isNotEmpty
149+
? customizationState!.textValue
150150
: null,
151151
layout: ButtonCustomizationUtils.getNavigationLayout(
152152
customizationState!.selectedChevron,
@@ -167,8 +167,8 @@ class _NavigationButtonDemoState extends State<_NavigationButtonDemo> {
167167
} else {
168168
return LightDarkBox(
169169
child: OudsNavigationButton(
170-
label: customizationState!.navigationTextValue.isNotEmpty
171-
? customizationState!.navigationTextValue
170+
label: customizationState!.textValue.isNotEmpty
171+
? customizationState!.textValue
172172
: null,
173173
layout: ButtonCustomizationUtils.getNavigationLayout(
174174
customizationState!.selectedChevron,
@@ -283,7 +283,7 @@ class _CustomizationContentState extends State<_CustomizationContent> {
283283
),
284284
CustomizableTextField(
285285
title: context.l10n.app_components_common_label_label,
286-
text: customizationState.navigationTextValue,
286+
text: customizationState.textValue,
287287
focusNode: labelFocus,
288288
fieldType: FieldType.label,
289289
),

app/lib/ui/utilities/customizable/customizable_textfield.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class CustomizableTextFieldState extends State<CustomizableTextField> {
124124
case FieldType.label:
125125
controlItemState?.labelText = value;
126126
buttonState?.textValue = value;
127-
buttonState?.navigationTextValue = value;
128127
badgeState?.countText = value;
129128
chipState?.labelText = value;
130129
tagState?.labelText = value;

app/lib/ui/utilities/customizable/customizable_widget_state.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ abstract class CustomizationWidgetState<T extends StatefulWidget>
4848
String get textValue => textState.value;
4949
set textValue(String value) => textState.value = value;
5050

51-
String get navigationTextValue => textState.navigationTextValue;
52-
set navigationTextValue(String value) =>
53-
textState.navigationTextValue = value;
54-
5551
bool get hasSelected => selectState.value;
5652
set hasSelected(bool value) => selectState.value = value;
5753

@@ -109,22 +105,14 @@ class TextState {
109105
TextState(this._setState);
110106

111107
final void Function(void Function()) _setState;
112-
String _textValue = "Button";
113-
String _navigationTextValue = "Next";
108+
String _textValue = "Label";
114109

115110
String get value => _textValue;
116111
set value(String newValue) {
117112
_setState(() {
118113
_textValue = newValue;
119114
});
120115
}
121-
122-
String get navigationTextValue => _navigationTextValue;
123-
set navigationTextValue(String newValue) {
124-
_setState(() {
125-
_navigationTextValue = newValue;
126-
});
127-
}
128116
}
129117

130118
/// Select State Management

ouds_core/lib/components/button/internal/ouds_button_icon_modifier.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class OudsButtonIconModifier {
235235
final buttonToken = OudsTheme.of(context).componentsTokens(context).button;
236236
switch (layout) {
237237
case OudsButtonLayout.iconOnly:
238-
return buttonToken.sizeIconDefault;
238+
return buttonToken.sizeIconOnlyDefault;
239239
case OudsButtonLayout.iconAndText:
240240
return buttonToken.sizeIconDefault;
241241
case OudsButtonLayout.textOnly:

0 commit comments

Comments
 (0)