Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/icon-button' into icon-button
Browse files Browse the repository at this point in the history
  • Loading branch information
sommye-ctr committed Aug 11, 2024
2 parents 8e3294d + a0c46d9 commit fbd8bb4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions forui/lib/src/widgets/button/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class FButton extends StatelessWidget {
@useResult
static _Data _of(BuildContext context) {
final theme = context.dependOnInheritedWidgetOfExactType<_InheritedData>();
return theme?.data ??
(style: context.theme.buttonStyles.primary, enabled: true);
return theme?.data ?? (style: context.theme.buttonStyles.primary, enabled: true);
}

/// The style. Defaults to [FButtonStyle.primary].
Expand Down Expand Up @@ -142,8 +141,7 @@ class FButton extends StatelessWidget {
onPress: onPress,
onLongPress: onLongPress,
child: DecoratedBox(
decoration:
enabled ? style.enabledBoxDecoration : style.disabledBoxDecoration,
decoration: enabled ? style.enabledBoxDecoration : style.disabledBoxDecoration,
child: _InheritedData(
data: (style: style, enabled: enabled),
child: child,
Expand All @@ -159,8 +157,7 @@ class FButton extends StatelessWidget {
..add(DiagnosticsProperty('style', style))
..add(DiagnosticsProperty('onPress', onPress))
..add(DiagnosticsProperty('onLongPress', onLongPress))
..add(FlagProperty('autofocus',
value: autofocus, defaultValue: false, ifTrue: 'autofocus'))
..add(FlagProperty('autofocus', value: autofocus, defaultValue: false, ifTrue: 'autofocus'))
..add(DiagnosticsProperty('focusNode', focusNode))
..add(DiagnosticsProperty('onFocusChange', onFocusChange))
..add(DiagnosticsProperty('builder', child));
Expand Down Expand Up @@ -248,8 +245,7 @@ class FButtonCustomStyle extends FButtonStyle with Diagnosticable {
}) =>
FButtonCustomStyle(
enabledBoxDecoration: enabledBoxDecoration ?? this.enabledBoxDecoration,
disabledBoxDecoration:
disabledBoxDecoration ?? this.disabledBoxDecoration,
disabledBoxDecoration: disabledBoxDecoration ?? this.disabledBoxDecoration,
content: content ?? this.content,
icon: icon ?? this.icon,
);
Expand All @@ -275,11 +271,7 @@ class FButtonCustomStyle extends FButtonStyle with Diagnosticable {
icon == other.icon;

@override
int get hashCode =>
enabledBoxDecoration.hashCode ^
disabledBoxDecoration.hashCode ^
content.hashCode ^
icon.hashCode;
int get hashCode => enabledBoxDecoration.hashCode ^ disabledBoxDecoration.hashCode ^ content.hashCode ^ icon.hashCode;
}

typedef _Data = ({FButtonCustomStyle style, bool enabled});
Expand Down

0 comments on commit fbd8bb4

Please sign in to comment.